gcc/libstdc++-v3/include/bits/stl_iterator.h

773 lines
25 KiB
C
Raw Normal View History

algo.h: Add "GPL plus runtime exception" comment block, this time for real. 2001-06-27 Phil Edwards <pme@sources.redhat.com> * include/backward/algo.h: Add "GPL plus runtime exception" comment block, this time for real. * include/backward/algobase.h: Likewise. * include/backward/alloc.h: Likewise. * include/backward/bvector.h: Likewise. * include/backward/defalloc.h: Likewise. * include/backward/deque.h: Likewise. * include/backward/function.h: Likewise. * include/backward/hash_map.h: Likewise. * include/backward/hash_set.h: Likewise. * include/backward/hashtable.h: Likewise. * include/backward/heap.h: Likewise. * include/backward/iterator.h: Likewise. * include/backward/list.h: Likewise. * include/backward/map.h: Likewise. * include/backward/multimap.h: Likewise. * include/backward/multiset.h: Likewise. * include/backward/pair.h: Likewise. * include/backward/rope.h: Likewise. * include/backward/set.h: Likewise. * include/backward/slist.h: Likewise. * include/backward/stack.h: Likewise. * include/backward/strstream: Likewise. * include/backward/tempbuf.h: Likewise. * include/backward/tree.h: Likewise. * include/backward/vector.h: Likewise. * include/bits/pthread_allocimpl.h: Likewise. * include/bits/std_algorithm.h: Likewise. * include/bits/std_bitset.h: Likewise. * include/bits/std_deque.h: Likewise. * include/bits/std_functional.h: Likewise. * include/bits/std_iterator.h: Likewise. * include/bits/std_list.h: Likewise. * include/bits/std_map.h: Likewise. * include/bits/std_memory.h: Likewise. * include/bits/std_numeric.h: Likewise. * include/bits/std_queue.h: Likewise. * include/bits/std_set.h: Likewise. * include/bits/std_stack.h: Likewise. * include/bits/std_utility.h: Likewise. * include/bits/std_vector.h: Likewise. * include/bits/stl_algo.h: Likewise. * include/bits/stl_algobase.h: Likewise. * include/bits/stl_alloc.h: Likewise. * include/bits/stl_bvector.h: Likewise. * include/bits/stl_construct.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_function.h: Likewise. * include/bits/stl_heap.h: Likewise. * include/bits/stl_iterator.h: Likewise. * include/bits/stl_iterator_base_funcs.h: Likewise. * include/bits/stl_iterator_base_types.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_numeric.h: Likewise. * include/bits/stl_pair.h: Likewise. * include/bits/stl_pthread_alloc.h: Likewise. * include/bits/stl_queue.h: Likewise. * include/bits/stl_raw_storage_iter.h: Likewise. * include/bits/stl_relops.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_stack.h: Likewise. * include/bits/stl_tempbuf.h: Likewise. * include/bits/stl_threads.h: Likewise. * include/bits/stl_tree.h: Likewise. * include/bits/stl_uninitialized.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/type_traits.h: Likewise. * include/ext/hash_map: Likewise. * include/ext/hash_set: Likewise. * include/ext/rope: Likewise. * include/ext/ropeimpl.h: Likewise. * include/ext/slist: Likewise. * include/ext/stl_hash_fun.h: Likewise. * include/ext/stl_hashtable.h: Likewise. * include/ext/stl_rope.h: Likewise. * src/bitset.cc: Likewise. * src/strstream.cc: Likewise. From-SVN: r43613
2001-06-27 19:09:53 +02:00
// Iterators -*- C++ -*-
// Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
algo.h: Add "GPL plus runtime exception" comment block, this time for real. 2001-06-27 Phil Edwards <pme@sources.redhat.com> * include/backward/algo.h: Add "GPL plus runtime exception" comment block, this time for real. * include/backward/algobase.h: Likewise. * include/backward/alloc.h: Likewise. * include/backward/bvector.h: Likewise. * include/backward/defalloc.h: Likewise. * include/backward/deque.h: Likewise. * include/backward/function.h: Likewise. * include/backward/hash_map.h: Likewise. * include/backward/hash_set.h: Likewise. * include/backward/hashtable.h: Likewise. * include/backward/heap.h: Likewise. * include/backward/iterator.h: Likewise. * include/backward/list.h: Likewise. * include/backward/map.h: Likewise. * include/backward/multimap.h: Likewise. * include/backward/multiset.h: Likewise. * include/backward/pair.h: Likewise. * include/backward/rope.h: Likewise. * include/backward/set.h: Likewise. * include/backward/slist.h: Likewise. * include/backward/stack.h: Likewise. * include/backward/strstream: Likewise. * include/backward/tempbuf.h: Likewise. * include/backward/tree.h: Likewise. * include/backward/vector.h: Likewise. * include/bits/pthread_allocimpl.h: Likewise. * include/bits/std_algorithm.h: Likewise. * include/bits/std_bitset.h: Likewise. * include/bits/std_deque.h: Likewise. * include/bits/std_functional.h: Likewise. * include/bits/std_iterator.h: Likewise. * include/bits/std_list.h: Likewise. * include/bits/std_map.h: Likewise. * include/bits/std_memory.h: Likewise. * include/bits/std_numeric.h: Likewise. * include/bits/std_queue.h: Likewise. * include/bits/std_set.h: Likewise. * include/bits/std_stack.h: Likewise. * include/bits/std_utility.h: Likewise. * include/bits/std_vector.h: Likewise. * include/bits/stl_algo.h: Likewise. * include/bits/stl_algobase.h: Likewise. * include/bits/stl_alloc.h: Likewise. * include/bits/stl_bvector.h: Likewise. * include/bits/stl_construct.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_function.h: Likewise. * include/bits/stl_heap.h: Likewise. * include/bits/stl_iterator.h: Likewise. * include/bits/stl_iterator_base_funcs.h: Likewise. * include/bits/stl_iterator_base_types.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_numeric.h: Likewise. * include/bits/stl_pair.h: Likewise. * include/bits/stl_pthread_alloc.h: Likewise. * include/bits/stl_queue.h: Likewise. * include/bits/stl_raw_storage_iter.h: Likewise. * include/bits/stl_relops.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_stack.h: Likewise. * include/bits/stl_tempbuf.h: Likewise. * include/bits/stl_threads.h: Likewise. * include/bits/stl_tree.h: Likewise. * include/bits/stl_uninitialized.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/type_traits.h: Likewise. * include/ext/hash_map: Likewise. * include/ext/hash_set: Likewise. * include/ext/rope: Likewise. * include/ext/ropeimpl.h: Likewise. * include/ext/slist: Likewise. * include/ext/stl_hash_fun.h: Likewise. * include/ext/stl_hashtable.h: Likewise. * include/ext/stl_rope.h: Likewise. * src/bitset.cc: Likewise. * src/strstream.cc: Likewise. From-SVN: r43613
2001-06-27 19:09:53 +02:00
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// As a special exception, you may use this file as part of a free software
// library without restriction. Specifically, if other files instantiate
// templates or use macros or inline functions from this file, or you compile
// this file and link it with other files to produce an executable, this
// file does not by itself cause the resulting executable to be covered by
// the GNU General Public License. This exception does not however
// invalidate any other reasons why the executable file might be covered by
// the GNU General Public License.
/*
*
* Copyright (c) 1994
* Hewlett-Packard Company
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*
*
* Copyright (c) 1996-1998
* Silicon Graphics Computer Systems, Inc.
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation. Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied warranty.
*/
c_io_stdio.h: Correct grammar in comments. 2001-11-02 Phil Edwards <pme@gcc.gnu.org> * config/io/c_io_stdio.h: Correct grammar in comments. * docs/doxygen/Intro.3: Expand "top-level" man page. * docs/doxygen/doxygroups.cc: New module definitions (comments). * docs/doxygen/mainpage.doxy: Tweaks. * docs/doxygen/run_doxygen: Update Doxygen version, massage man pages. Add @file hooks so that headers are considered to be documented. * include/bits/basic_ios.h, include/bits/basic_file.h, include/bits/basic_string.h, include/bits/boost_concept_check.h, include/bits/char_traits.h, include/bits/codecvt.h, include/bits/concept_check.h, include/bits/cpp_type_traits.h, include/bits/fpos.h, include/bits/gslice.h, include/bits/gslice_array.h, include/bits/indirect_array.h, include/bits/ios_base.h, include/bits/locale_facets.h, include/bits/localefwd.h, include/bits/mask_array.h, include/bits/pthread_allocimpl.h, include/bits/slice.h, include/bits/slice_array.h, include/bits/std_algorithm.h, include/bits/std_bitset.h, include/bits/std_complex.h, include/bits/std_deque.h, include/bits/std_fstream.h, include/bits/std_functional.h, include/bits/std_iomanip.h, include/bits/std_ios.h, include/bits/std_iosfwd.h, include/bits/std_iostream.h, include/bits/std_istream.h, include/bits/std_iterator.h, include/bits/std_limits.h, include/bits/std_list.h, include/bits/std_locale.h, include/bits/std_map.h, include/bits/std_memory.h, include/bits/std_numeric.h, include/bits/std_ostream.h, include/bits/std_queue.h, include/bits/std_set.h, include/bits/std_sstream.h, include/bits/std_stack.h, include/bits/std_streambuf.h, include/bits/std_string.h, include/bits/std_utility.h, include/bits/std_valarray.h, include/bits/std_vector.h, include/bits/stl_algo.h, include/bits/stl_alloc.h, include/bits/stl_bvector.h, include/bits/stl_construct.h, include/bits/stl_deque.h, include/bits/stl_heap.h, include/bits/stl_iterator.h, include/bits/stl_iterator_base_funcs.h, include/bits/stl_iterator_base_types.h, include/bits/stl_list.h, include/bits/stl_map.h, include/bits/stl_multimap.h, include/bits/stl_multiset.h, include/bits/stl_numeric.h, include/bits/stl_pair.h, include/bits/stl_pthread_alloc.h, include/bits/stl_queue.h, include/bits/stl_raw_storage_iter.h, include/bits/stl_relops.h, include/bits/stl_set.h, include/bits/stl_stack.h, include/bits/stl_tempbuf.h, include/bits/stl_threads.h, include/bits/stl_tree.h, include/bits/stl_uninitialized.h, include/bits/stl_vector.h, include/bits/stream_iterator.h, include/bits/streambuf_iterator.h, include/bits/stringfwd.h, include/bits/type_traits.h, include/bits/valarray_array.h, include/bits/valarray_meta.h: Add hooks, tweak comments only. * include/bits/stl_algobase.h (swap, min, iter_swap): Also document these functions. * include/bits/stl_function.h: Tweak link comments. From-SVN: r46717
2001-11-02 18:38:11 +01:00
/** @file stl_iterator.h
* This is an internal header file, included by other library headers.
* You should not attempt to use it directly.
*
* This file implements reverse_iterator, back_insert_iterator,
* front_insert_iterator, insert_iterator, __normal_iterator, and their
* supporting functions and overloaded operators.
*/
#ifndef _ITERATOR_H
#define _ITERATOR_H 1
algo.h: Use std not __STD. 2001-03-04 Phil Edwards <pme@sources.redhat.com> http://gcc.gnu.org/ml/libstdc++/2001-03/msg00015.html * include/backward/algo.h: Use std not __STD. Remove unneeded macros and "never happens" code. Adjust to C++STYLE guidelines. * include/backward/algobase.h: Likewise. * include/backward/alloc.h: Likewise. * include/backward/bvector.h: Likewise. * include/backward/deque.h: Likewise. * include/backward/function.h: Likewise. * include/backward/hash_map.h: Likewise. * include/backward/hash_set.h: Likewise. * include/backward/hashtable.h: Likewise. * include/backward/heap.h: Likewise. * include/backward/iterator.h: Likewise. * include/backward/list.h: Likewise. * include/backward/map.h: Likewise. * include/backward/multimap.h: Likewise. * include/backward/multiset.h: Likewise. * include/backward/pair.h: Likewise. * include/backward/rope.h: Likewise. * include/backward/set.h: Likewise. * include/backward/slist.h: Likewise. * include/backward/stack.h: Likewise. * include/backward/strstream: Likewise. * include/backward/tempbuf.h: Likewise. * include/backward/tree.h: Likewise. * include/backward/vector.h: Likewise. * include/bits/basic_ios.h: Likewise. * include/bits/basic_ios.tcc: Likewise. * include/bits/basic_string.h: Likewise. * include/bits/c++config: Likewise. * include/bits/concept_checks.h: Likewise. * include/bits/fpos.h: Likewise. * include/bits/fstream.tcc: Likewise. * include/bits/functexcept.h: Likewise. * include/bits/ios_base.h: Likewise. * include/bits/istream.tcc: Likewise. * include/bits/mask_array.h: Likewise. * include/bits/ostream.tcc: Likewise. * include/bits/pthread_allocimpl.h: Likewise. * include/bits/sbuf_iter.h: Likewise. * include/bits/slice.h: Likewise. * include/bits/slice_array.h: Likewise. * include/bits/sstream.tcc: Likewise. * include/bits/std_bitset.h: Likewise. * include/bits/std_fstream.h: Likewise. * include/bits/std_iomanip.h: Likewise. * include/bits/std_ios.h: Likewise. * include/bits/std_istream.h: Likewise. * include/bits/std_iterator.h: Likewise. * include/bits/std_memory.h: Likewise. * include/bits/std_ostream.h: Likewise. * include/bits/std_sstream.h: Likewise. * include/bits/std_streambuf.h: Likewise. * include/bits/std_string.h: Likewise. * include/bits/std_valarray.h: Likewise. * include/bits/stl_algo.h: Likewise. * include/bits/stl_algobase.h: Likewise. * include/bits/stl_alloc.h: Likewise. * include/bits/stl_construct.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_function.h: Likewise. * include/bits/stl_heap.h: Likewise. * include/bits/stl_iterator.h: Likewise. * include/bits/stl_iterator_base.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_numeric.h: Likewise. * include/bits/stl_pair.h: Likewise. * include/bits/stl_pthread_alloc.h: Likewise. * include/bits/stl_queue.h: Likewise. * include/bits/stl_raw_storage_iter.h: Likewise. * include/bits/stl_relops.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_stack.h: Likewise. * include/bits/stl_tempbuf.h: Likewise. * include/bits/stl_threads.h: Likewise. * include/bits/stl_tree.h: Likewise. * include/bits/stl_uninitialized.h: Likewise. * include/bits/stl_vector.h: Likewise. * include/bits/streambuf.tcc: Likewise. * include/bits/type_traits.h: Likewise. * include/bits/valarray_meta.h: Likewise. * include/ext/bvector: Likewise. * include/ext/hash_map: Likewise. * include/ext/hash_set: Likewise. * include/ext/ropeimpl.h: Likewise. * include/ext/slist: Likewise. * include/ext/stl_bvector.h: Likewise. * include/ext/stl_hash_fun.h: Likewise. * include/ext/stl_hashtable.h: Likewise. * include/ext/stl_rope.h: Likewise. * src/complex_io.cc: Likewise. * src/ios.cc: Likewise. * src/locale-inst.cc: Likewise. * src/locale.cc: Likewise. * src/localename.cc: Likewise. * src/misc-inst.cc: Likewise. * src/stdexcept.cc: Likewise. * src/stl-inst.cc: Likewise. * src/strstream.cc: Likewise. * src/valarray-inst.cc: Likewise. From-SVN: r40239
2001-03-04 22:34:02 +01:00
namespace std
{
// 24.4.1 Reverse iterators
/**
* "Bidirectional and random access iterators have corresponding reverse
* %iterator adaptors that iterate through the data structure in the
* opposite direction. They have the same signatures as the corresponding
* iterators. The fundamental relation between a reverse %iterator and its
* corresponding %iterator @c i is established by the identity:
* @code
* &*(reverse_iterator(i)) == &*(i - 1)
* @endcode
*
* This mapping is dictated by the fact that while there is always a
* pointer past the end of an array, there might not be a valid pointer
* before the beginning of an array." [24.4.1]/1,2
*
* Reverse iterators can be tricky and surprising at first. Their
* semantics make sense, however, and the trickiness is a side effect of
* the requirement that the iterators must be safe.
*/
template<typename _Iterator>
class reverse_iterator
: public iterator<typename iterator_traits<_Iterator>::iterator_category,
typename iterator_traits<_Iterator>::value_type,
typename iterator_traits<_Iterator>::difference_type,
typename iterator_traits<_Iterator>::pointer,
typename iterator_traits<_Iterator>::reference>
{
protected:
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
_Iterator current;
public:
typedef _Iterator iterator_type;
typedef typename iterator_traits<_Iterator>::difference_type
difference_type;
typedef typename iterator_traits<_Iterator>::reference reference;
typedef typename iterator_traits<_Iterator>::pointer pointer;
public:
/**
* The default constructor default-initializes member @p current.
* If it is a pointer, that means it is zero-initialized.
*/
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 235 No specification of default ctor for reverse_iterator
reverse_iterator() : current() { }
/**
* This %iterator will move in the opposite direction that @p x does.
*/
explicit
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
reverse_iterator(iterator_type __x) : current(__x) { }
/**
* The copy constructor is normal.
*/
reverse_iterator(const reverse_iterator& __x)
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
: current(__x.current) { }
/**
* A reverse_iterator across other types can be copied in the normal
* fashion.
*/
template<typename _Iter>
reverse_iterator(const reverse_iterator<_Iter>& __x)
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
: current(__x.base()) { }
/**
* @return @c current, the %iterator used for underlying work.
*/
iterator_type
base() const
{ return current; }
/**
* @return TODO
*
* @doctodo
*/
reference
operator*() const
{
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
_Iterator __tmp = current;
return *--__tmp;
}
/**
* @return TODO
*
* @doctodo
*/
pointer
operator->() const
{ return &(operator*()); }
/**
* @return TODO
*
* @doctodo
*/
reverse_iterator&
operator++()
{
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
--current;
return *this;
}
/**
* @return TODO
*
* @doctodo
*/
reverse_iterator
operator++(int)
{
reverse_iterator __tmp = *this;
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
--current;
return __tmp;
}
/**
* @return TODO
*
* @doctodo
*/
reverse_iterator&
operator--()
{
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
++current;
return *this;
}
/**
* @return TODO
*
* @doctodo
*/
reverse_iterator operator--(int)
{
reverse_iterator __tmp = *this;
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
++current;
return __tmp;
}
/**
* @return TODO
*
* @doctodo
*/
reverse_iterator
operator+(difference_type __n) const
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
{ return reverse_iterator(current - __n); }
/**
* @return TODO
*
* @doctodo
*/
reverse_iterator&
operator+=(difference_type __n)
{
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
current -= __n;
return *this;
}
/**
* @return TODO
*
* @doctodo
*/
reverse_iterator
operator-(difference_type __n) const
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
{ return reverse_iterator(current + __n); }
/**
* @return TODO
*
* @doctodo
*/
reverse_iterator&
operator-=(difference_type __n)
{
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
current += __n;
return *this;
}
/**
* @return TODO
*
* @doctodo
*/
reference
operator[](difference_type __n) const
{ return *(*this + __n); }
};
//@{
/**
* @param x A %reverse_iterator.
* @param y A %reverse_iterator.
* @return A simple bool.
*
* Reverse iterators forward many operations to their underlying base()
* iterators. Others are implemented in terms of one another.
*
*/
template<typename _Iterator>
inline bool
operator==(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y)
{ return __x.base() == __y.base(); }
template<typename _Iterator>
inline bool
operator<(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y)
{ return __y.base() < __x.base(); }
template<typename _Iterator>
inline bool
operator!=(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y)
{ return !(__x == __y); }
template<typename _Iterator>
inline bool
operator>(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y)
{ return __y < __x; }
template<typename _Iterator>
inline bool
operator<=(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y)
{ return !(__y < __x); }
template<typename _Iterator>
inline bool
operator>=(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y)
{ return !(__x < __y); }
template<typename _Iterator>
inline typename reverse_iterator<_Iterator>::difference_type
operator-(const reverse_iterator<_Iterator>& __x,
const reverse_iterator<_Iterator>& __y)
{ return __y.base() - __x.base(); }
template<typename _Iterator>
inline reverse_iterator<_Iterator>
operator+(typename reverse_iterator<_Iterator>::difference_type __n,
const reverse_iterator<_Iterator>& __x)
{ return reverse_iterator<_Iterator>(__x.base() - __n); }
//@}
// 24.4.2.2.1 back_insert_iterator
/**
* @brief Turns assignment into insertion.
*
* These are output iterators, constructed from a container-of-T.
* Assigning a T to the iterator appends it to the container using
* push_back.
*
* Tip: Using the back_inserter function to create these iterators can
* save typing.
*/
template<typename _Container>
class back_insert_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
protected:
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
_Container* container;
public:
/// A nested typedef for the type of whatever container you used.
typedef _Container container_type;
/// The only way to create this %iterator is with a container.
explicit
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
back_insert_iterator(_Container& __x) : container(&__x) { }
/**
* @param value An instance of whatever type
* container_type::const_reference is; presumably a
* reference-to-const T for container<T>.
* @return This %iterator, for chained operations.
*
* This kind of %iterator doesn't really have a "position" in the
* container (you can think of the position as being permanently at
* the end, if you like). Assigning a value to the %iterator will
* always append the value to the end of the container.
*/
back_insert_iterator&
operator=(typename _Container::const_reference __value)
{
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
container->push_back(__value);
return *this;
}
/// Simply returns *this.
back_insert_iterator&
operator*()
{ return *this; }
/// Simply returns *this. (This %iterator does not "move".)
back_insert_iterator&
operator++()
{ return *this; }
/// Simply returns *this. (This %iterator does not "move".)
back_insert_iterator
operator++(int)
{ return *this; }
};
/**
* @param x A container of arbitrary type.
* @return An instance of back_insert_iterator working on @p x.
*
* This wrapper function helps in creating back_insert_iterator instances.
* Typing the name of the %iterator requires knowing the precise full
* type of the container, which can be tedious and impedes generic
* programming. Using this function lets you take advantage of automatic
* template parameter deduction, making the compiler match the correct
* types for you.
*/
template<typename _Container>
inline back_insert_iterator<_Container>
back_inserter(_Container& __x)
{ return back_insert_iterator<_Container>(__x); }
/**
* @brief Turns assignment into insertion.
*
* These are output iterators, constructed from a container-of-T.
* Assigning a T to the iterator prepends it to the container using
* push_front.
*
* Tip: Using the front_inserter function to create these iterators can
* save typing.
*/
template<typename _Container>
class front_insert_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
protected:
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
_Container* container;
public:
/// A nested typedef for the type of whatever container you used.
typedef _Container container_type;
/// The only way to create this %iterator is with a container.
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
explicit front_insert_iterator(_Container& __x) : container(&__x) { }
/**
* @param value An instance of whatever type
* container_type::const_reference is; presumably a
* reference-to-const T for container<T>.
* @return This %iterator, for chained operations.
*
* This kind of %iterator doesn't really have a "position" in the
* container (you can think of the position as being permanently at
* the front, if you like). Assigning a value to the %iterator will
* always prepend the value to the front of the container.
*/
front_insert_iterator&
operator=(typename _Container::const_reference __value)
{
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
container->push_front(__value);
return *this;
}
/// Simply returns *this.
front_insert_iterator&
operator*()
{ return *this; }
/// Simply returns *this. (This %iterator does not "move".)
front_insert_iterator&
operator++()
{ return *this; }
/// Simply returns *this. (This %iterator does not "move".)
front_insert_iterator
operator++(int)
{ return *this; }
};
/**
* @param x A container of arbitrary type.
* @return An instance of front_insert_iterator working on @p x.
*
* This wrapper function helps in creating front_insert_iterator instances.
* Typing the name of the %iterator requires knowing the precise full
* type of the container, which can be tedious and impedes generic
* programming. Using this function lets you take advantage of automatic
* template parameter deduction, making the compiler match the correct
* types for you.
*/
template<typename _Container>
inline front_insert_iterator<_Container>
front_inserter(_Container& __x)
{ return front_insert_iterator<_Container>(__x); }
/**
* @brief Turns assignment into insertion.
*
* These are output iterators, constructed from a container-of-T.
* Assigning a T to the iterator inserts it in the container at the
* %iterator's position, rather than overwriting the value at that
* position.
*
* (Sequences will actually insert a @e copy of the value before the
* %iterator's position.)
*
* Tip: Using the inserter function to create these iterators can
* save typing.
*/
template<typename _Container>
class insert_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
protected:
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
_Container* container;
typename _Container::iterator iter;
public:
/// A nested typedef for the type of whatever container you used.
typedef _Container container_type;
/**
* The only way to create this %iterator is with a container and an
* initial position (a normal %iterator into the container).
*/
insert_iterator(_Container& __x, typename _Container::iterator __i)
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
: container(&__x), iter(__i) {}
/**
* @param value An instance of whatever type
* container_type::const_reference is; presumably a
* reference-to-const T for container<T>.
* @return This %iterator, for chained operations.
*
* This kind of %iterator maintains its own position in the
* container. Assigning a value to the %iterator will insert the
* value into the container at the place before the %iterator.
*
* The position is maintained such that subsequent assignments will
* insert values immediately after one another. For example,
* @code
* // vector v contains A and Z
*
* insert_iterator i (v, ++v.begin());
* i = 1;
* i = 2;
* i = 3;
*
* // vector v contains A, 1, 2, 3, and Z
* @endcode
*/
insert_iterator&
operator=(const typename _Container::const_reference __value)
{
stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> * include/bits/stl_iterator.h (reverse_iterator::_M_current): Deuglify, should be current. (back_insert_iterator::_M_container): Deuglify, should be container. (front_insert_iterator::_M_container): Same. (insert_iterator::_M_container): Same. * testsuite/24_iterators/reverse_iterator.cc: Add check. * testsuite/24_iterators/back_insert_iterator.cc: Add check. * testsuite/24_iterators/front_insert_iterator.cc: Same. * testsuite/24_iterators/insert_iterator.cc: Same. 2002-01-16 Benjamin Kosnik <bkoz@redhat.com> * include/bits/locale_facets.h (ctype<char>::classic_table): Make static. (ctype<char>::_M_ctable): Make static, change name to _S_ctable. * config/os/gnu-linux/bits/ctype_noninline.h: Define _S_ctable. * config/os/solaris/solaris2.7/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.6/bits/ctype_noninline.h: Same. * config/os/solaris/solaris2.5/bits/ctype_noninline.h: Same. * config/os/newlib/bits/ctype_noninline.h: Same. * config/os/irix/irix6.5/bits/ctype_noninline.h: Same. * config/os/irix/irix5.2/bits/ctype_noninline.h: Same. * config/os/hpux/bits/ctype_noninline.h: Same. * config/os/djgpp/bits/ctype_noninline.h: Same. * config/os/bsd/netbsd/bits/ctype_noninline.h: Same. * config/os/bsd/freebsd/bits/ctype_noninline.h: Same. * config/os/aix/bits/ctype_noninline.h: Same. Testcase by Dietmar K�hl via Peter Schmid * testsuite/22_locale/ctype_members_char.cc (char>): Add test for classic_table(). Co-Authored-By: Peter Schmid <schmid@snake.iap.physik.tu-darmstadt.de> From-SVN: r48938
2002-01-17 04:59:42 +01:00
iter = container->insert(iter, __value);
++iter;
return *this;
}
/// Simply returns *this.
insert_iterator&
operator*()
{ return *this; }
/// Simply returns *this. (This %iterator does not "move".)
insert_iterator&
operator++()
{ return *this; }
/// Simply returns *this. (This %iterator does not "move".)
insert_iterator&
operator++(int)
{ return *this; }
};
/**
* @param x A container of arbitrary type.
* @return An instance of insert_iterator working on @p x.
*
* This wrapper function helps in creating insert_iterator instances.
* Typing the name of the %iterator requires knowing the precise full
* type of the container, which can be tedious and impedes generic
* programming. Using this function lets you take advantage of automatic
* template parameter deduction, making the compiler match the correct
* types for you.
*/
template<typename _Container, typename _Iterator>
inline insert_iterator<_Container>
inserter(_Container& __x, _Iterator __i)
{
return insert_iterator<_Container>(__x,
typename _Container::iterator(__i));
}
} // namespace std
namespace __gnu_cxx
{
// This iterator adapter is 'normal' in the sense that it does not
// change the semantics of any of the operators of its iterator
// parameter. Its primary purpose is to convert an iterator that is
// not a class, e.g. a pointer, into an iterator that is a class.
// The _Container parameter exists solely so that different containers
// using this template can instantiate different types, even if the
// _Iterator parameter is the same.
using std::iterator_traits;
using std::iterator;
template<typename _Iterator, typename _Container>
class __normal_iterator
{
protected:
_Iterator _M_current;
public:
typedef typename iterator_traits<_Iterator>::iterator_category
iterator_category;
typedef typename iterator_traits<_Iterator>::value_type value_type;
typedef typename iterator_traits<_Iterator>::difference_type
difference_type;
typedef typename iterator_traits<_Iterator>::reference reference;
typedef typename iterator_traits<_Iterator>::pointer pointer;
__normal_iterator() : _M_current(_Iterator()) { }
explicit
__normal_iterator(const _Iterator& __i) : _M_current(__i) { }
// Allow iterator to const_iterator conversion
template<typename _Iter>
inline __normal_iterator(const __normal_iterator<_Iter,
_Container>& __i)
: _M_current(__i.base()) { }
// Forward iterator requirements
reference
operator*() const
{ return *_M_current; }
pointer
operator->() const
{ return _M_current; }
__normal_iterator&
operator++()
{
++_M_current;
return *this;
}
__normal_iterator
operator++(int)
{ return __normal_iterator(_M_current++); }
// Bidirectional iterator requirements
__normal_iterator&
operator--()
{
--_M_current;
return *this;
}
__normal_iterator
operator--(int)
{ return __normal_iterator(_M_current--); }
// Random access iterator requirements
reference
operator[](const difference_type& __n) const
{ return _M_current[__n]; }
__normal_iterator&
operator+=(const difference_type& __n)
{ _M_current += __n; return *this; }
__normal_iterator
operator+(const difference_type& __n) const
{ return __normal_iterator(_M_current + __n); }
__normal_iterator&
operator-=(const difference_type& __n)
{ _M_current -= __n; return *this; }
__normal_iterator
operator-(const difference_type& __n) const
{ return __normal_iterator(_M_current - __n); }
const _Iterator&
base() const
{ return _M_current; }
};
// Note: In what follows, the left- and right-hand-side iterators are
// allowed to vary in types (conceptually in cv-qualification) so that
// comparaison between cv-qualified and non-cv-qualified iterators be
// valid. However, the greedy and unfriendly operators in std::rel_ops
// will make overload resolution ambiguous (when in scope) if we don't
// provide overloads whose operands are of the same type. Can someone
// remind me what generic programming is about? -- Gaby
// Forward iterator requirements
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline bool
operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
{ return __lhs.base() == __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
{ return __lhs.base() == __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline bool
operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
{ return __lhs.base() != __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator!=(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
{ return __lhs.base() != __rhs.base(); }
// Random access iterator requirements
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline bool
operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
{ return __lhs.base() < __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
{ return __lhs.base() < __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline bool
operator>(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
{ return __lhs.base() > __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator>(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
{ return __lhs.base() > __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline bool
operator<=(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
{ return __lhs.base() <= __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator<=(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
{ return __lhs.base() <= __rhs.base(); }
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline bool
operator>=(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
{ return __lhs.base() >= __rhs.base(); }
template<typename _Iterator, typename _Container>
inline bool
operator>=(const __normal_iterator<_Iterator, _Container>& __lhs,
const __normal_iterator<_Iterator, _Container>& __rhs)
{ return __lhs.base() >= __rhs.base(); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// According to the resolution of DR179 not only the various comparison
// operators but also operator- must accept mixed iterator/const_iterator
// parameters.
template<typename _IteratorL, typename _IteratorR, typename _Container>
inline typename __normal_iterator<_IteratorL, _Container>::difference_type
operator-(const __normal_iterator<_IteratorL, _Container>& __lhs,
const __normal_iterator<_IteratorR, _Container>& __rhs)
{ return __lhs.base() - __rhs.base(); }
template<typename _Iterator, typename _Container>
inline __normal_iterator<_Iterator, _Container>
operator+(typename __normal_iterator<_Iterator, _Container>::difference_type
__n, const __normal_iterator<_Iterator, _Container>& __i)
{ return __normal_iterator<_Iterator, _Container>(__i.base() + __n); }
} // namespace __gnu_cxx
#endif
// Local Variables:
// mode:C++
// End: