From 0cd50f8913574aff26ae486c87e964462025b791 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Mon, 15 Oct 2007 20:51:53 +0000 Subject: [PATCH] set.h (set<>::cbegin, [...]): Add. 2007-10-15 Paolo Carlini * include/debug/set.h (set<>::cbegin, cend, crbegin, crend): Add. * include/debug/multiset.h (set<>::cbegin, cend, crbegin, crend): Likewise. * include/debug/vector (vector<>::cbegin, cend, crbegin, crend): Likewise. * include/debug/map.h (map<>::cbegin, cend, crbegin, crend): Likewise. * include/debug/deque (deque<>::cbegin, cend, crbegin, crend): Likewise. * include/debug/list (list<>::cbegin, cend, crbegin, crend): Likewise. * include/debug/multimap.h (multimap<>::cbegin, cend, crbegin, crend): Likewise. * include/tr1_impl/array (array<>::cbegin, cend, crbegin, crend): Likewise. * include/ext/vstring.h (__versa_string<>::cbegin, cend, crbegin, crend): Likewise. * include/bits/stl_list.h (list<>::cbegin, cend, crbegin, crend): Likewise. * include/bits/stl_map.h (map<>::cbegin, cend, crbegin, crend): Likewise. * include/bits/stl_set.h (set<>::cbegin, cend, crbegin, crend): Likewise. * include/bits/stl_multimap.h (multimap<>::cbegin, cend, crbegin, crend): Likewise. * include/bits/stl_vector.h (vector<>::cbegin, cend, crbegin, crend): Likewise. * include/bits/stl_deque.h (deque<>::cbegin, cend, crbegin, crend): Likewise. * include/bits/stl_multiset.h (multiset<>::cbegin, cend, crbegin, crend): Likewise. * include/bits/stl_bvector.h (vector::cbegin, cend, crbegin, crend): Likewise. * include/tr1_impl/hashtable (_Hashtable<>::cbegin, cend): Add. * testsuite/ext/vstring/requirements/citerators.cc: Add. * testsuite/23_containers/unordered_map/requirements/citerators.cc: Likewise. * testsuite/23_containers/multimap/requirements/citerators.cc: Likewise. * testsuite/23_containers/set/requirements/citerators.cc: Likewise. * testsuite/23_containers/unordered_multimap/requirements/ citerators.cc: Likewise. * testsuite/23_containers/unordered_set/requirements/citerators.cc: Likewise. * testsuite/23_containers/vector/requirements/citerators.cc: Likewise. * testsuite/23_containers/vector/bool/requirements/citerators.cc: Likewise. * testsuite/23_containers/deque/requirements/citerators.cc: Likewise. * testsuite/23_containers/multiset/requirements/citerators.cc: Likewise. * testsuite/23_containers/list/requirements/citerators.cc: Likewise. * testsuite/23_containers/unordered_multiset/requirements/ citerators.cc: Likewise. * testsuite/23_containers/map/requirements/citerators.cc: Likewise. * testsuite/23_containers/array/requirements/citerators.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: Adjust dg-error lines. * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/vector/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/deque/requirements/dr438/ constructor_2_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_1_neg.cc: Likewise. * testsuite/23_containers/list/requirements/dr438/ constructor_2_neg.cc: Likewise. From-SVN: r129370 --- libstdc++-v3/ChangeLog | 84 +++++++++++++++++++ libstdc++-v3/include/bits/stl_bvector.h | 18 ++++ libstdc++-v3/include/bits/stl_deque.h | 37 ++++++++ libstdc++-v3/include/bits/stl_list.h | 38 +++++++++ libstdc++-v3/include/bits/stl_map.h | 38 +++++++++ libstdc++-v3/include/bits/stl_multimap.h | 38 +++++++++ libstdc++-v3/include/bits/stl_multiset.h | 62 +++++++++++--- libstdc++-v3/include/bits/stl_set.h | 56 +++++++++++-- libstdc++-v3/include/bits/stl_vector.h | 38 +++++++++ libstdc++-v3/include/debug/deque | 18 ++++ libstdc++-v3/include/debug/list | 18 ++++ libstdc++-v3/include/debug/map.h | 18 ++++ libstdc++-v3/include/debug/multimap.h | 18 ++++ libstdc++-v3/include/debug/multiset.h | 18 ++++ libstdc++-v3/include/debug/set.h | 18 ++++ libstdc++-v3/include/debug/vector | 18 ++++ libstdc++-v3/include/ext/vstring.h | 36 ++++++++ libstdc++-v3/include/tr1_impl/array | 18 ++++ libstdc++-v3/include/tr1_impl/hashtable | 15 ++++ .../array/requirements/citerators.cc | 53 ++++++++++++ .../deque/requirements/citerators.cc | 53 ++++++++++++ .../deque/requirements/dr438/assign_neg.cc | 2 +- .../requirements/dr438/constructor_1_neg.cc | 2 +- .../requirements/dr438/constructor_2_neg.cc | 2 +- .../deque/requirements/dr438/insert_neg.cc | 2 +- .../list/requirements/citerators.cc | 53 ++++++++++++ .../list/requirements/dr438/assign_neg.cc | 2 +- .../requirements/dr438/constructor_1_neg.cc | 2 +- .../requirements/dr438/constructor_2_neg.cc | 2 +- .../list/requirements/dr438/insert_neg.cc | 2 +- .../map/requirements/citerators.cc | 54 ++++++++++++ .../multimap/requirements/citerators.cc | 55 ++++++++++++ .../multiset/requirements/citerators.cc | 54 ++++++++++++ .../set/requirements/citerators.cc | 54 ++++++++++++ .../unordered_map/requirements/citerators.cc | 51 +++++++++++ .../requirements/citerators.cc | 52 ++++++++++++ .../requirements/citerators.cc | 51 +++++++++++ .../unordered_set/requirements/citerators.cc | 51 +++++++++++ .../vector/bool/requirements/citerators.cc | 53 ++++++++++++ .../vector/requirements/citerators.cc | 53 ++++++++++++ .../vector/requirements/dr438/assign_neg.cc | 2 +- .../requirements/dr438/constructor_1_neg.cc | 2 +- .../requirements/dr438/constructor_2_neg.cc | 2 +- .../vector/requirements/dr438/insert_neg.cc | 2 +- .../ext/vstring/requirements/citerators.cc | 53 ++++++++++++ 45 files changed, 1336 insertions(+), 32 deletions(-) create mode 100644 libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc create mode 100644 libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 76b8aa5ab43..c72ab4764f8 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,87 @@ +2007-10-15 Paolo Carlini + + * include/debug/set.h (set<>::cbegin, cend, crbegin, crend): Add. + * include/debug/multiset.h (set<>::cbegin, cend, crbegin, crend): + Likewise. + * include/debug/vector (vector<>::cbegin, cend, crbegin, crend): + Likewise. + * include/debug/map.h (map<>::cbegin, cend, crbegin, crend): + Likewise. + * include/debug/deque (deque<>::cbegin, cend, crbegin, crend): + Likewise. + * include/debug/list (list<>::cbegin, cend, crbegin, crend): + Likewise. + * include/debug/multimap.h (multimap<>::cbegin, cend, crbegin, + crend): Likewise. + * include/tr1_impl/array (array<>::cbegin, cend, crbegin, crend): + Likewise. + * include/ext/vstring.h (__versa_string<>::cbegin, cend, crbegin, + crend): Likewise. + * include/bits/stl_list.h (list<>::cbegin, cend, crbegin, crend): + Likewise. + * include/bits/stl_map.h (map<>::cbegin, cend, crbegin, crend): + Likewise. + * include/bits/stl_set.h (set<>::cbegin, cend, crbegin, crend): + Likewise. + * include/bits/stl_multimap.h (multimap<>::cbegin, cend, crbegin, + crend): Likewise. + * include/bits/stl_vector.h (vector<>::cbegin, cend, crbegin, crend): + Likewise. + * include/bits/stl_deque.h (deque<>::cbegin, cend, crbegin, crend): + Likewise. + * include/bits/stl_multiset.h (multiset<>::cbegin, cend, crbegin, + crend): Likewise. + * include/bits/stl_bvector.h (vector::cbegin, cend, crbegin, + crend): Likewise. + * include/tr1_impl/hashtable (_Hashtable<>::cbegin, cend): Add. + + * testsuite/ext/vstring/requirements/citerators.cc: Add. + * testsuite/23_containers/unordered_map/requirements/citerators.cc: + Likewise. + * testsuite/23_containers/multimap/requirements/citerators.cc: + Likewise. + * testsuite/23_containers/set/requirements/citerators.cc: Likewise. + * testsuite/23_containers/unordered_multimap/requirements/ + citerators.cc: Likewise. + * testsuite/23_containers/unordered_set/requirements/citerators.cc: + Likewise. + * testsuite/23_containers/vector/requirements/citerators.cc: Likewise. + * testsuite/23_containers/vector/bool/requirements/citerators.cc: + Likewise. + * testsuite/23_containers/deque/requirements/citerators.cc: Likewise. + * testsuite/23_containers/multiset/requirements/citerators.cc: + Likewise. + * testsuite/23_containers/list/requirements/citerators.cc: Likewise. + * testsuite/23_containers/unordered_multiset/requirements/ + citerators.cc: Likewise. + * testsuite/23_containers/map/requirements/citerators.cc: Likewise. + * testsuite/23_containers/array/requirements/citerators.cc: Likewise. + + * testsuite/23_containers/vector/requirements/dr438/assign_neg.cc: + Adjust dg-error lines. + * testsuite/23_containers/vector/requirements/dr438/insert_neg.cc: + Likewise. + * testsuite/23_containers/vector/requirements/dr438/ + constructor_1_neg.cc: Likewise. + * testsuite/23_containers/vector/requirements/dr438/ + constructor_2_neg.cc: Likewise. + * testsuite/23_containers/deque/requirements/dr438/assign_neg.cc: + Likewise. + * testsuite/23_containers/deque/requirements/dr438/insert_neg.cc: + Likewise. + * testsuite/23_containers/deque/requirements/dr438/ + constructor_1_neg.cc: Likewise. + * testsuite/23_containers/deque/requirements/dr438/ + constructor_2_neg.cc: Likewise. + * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: + Likewise. + * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: + Likewise. + * testsuite/23_containers/list/requirements/dr438/ + constructor_1_neg.cc: Likewise. + * testsuite/23_containers/list/requirements/dr438/ + constructor_2_neg.cc: Likewise. + 2007-10-15 Paolo Carlini PR libstdc++/33773 (cont) diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index db9061b90fb..a7044564d96 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -602,6 +602,24 @@ template rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { return this->_M_impl._M_start; } + + const_iterator + cend() const + { return this->_M_impl._M_finish; } + + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + size_type size() const { return size_type(end() - begin()); } diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index 7a7b86e2d38..41cd231f446 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -909,6 +909,43 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) rend() const { return const_reverse_iterator(this->_M_impl._M_start); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %deque. Iteration is done in ordinary element order. + */ + const_iterator + cbegin() const + { return this->_M_impl._M_start; } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %deque. Iteration is done in + * ordinary element order. + */ + const_iterator + cend() const + { return this->_M_impl._M_finish; } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last element in the %deque. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(this->_M_impl._M_finish); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first element in the %deque. Iteration is + * done in reverse element order. + */ + const_reverse_iterator + crend() const + { return const_reverse_iterator(this->_M_impl._M_start); } +#endif + // [23.2.1.2] capacity /** Returns the number of elements in the %deque. */ size_type diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 2b690eb5486..7bdeacb33fa 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -691,6 +691,44 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * Returns a read-only (constant) iterator that points to the + * first element in the %list. Iteration is done in ordinary + * element order. + */ + const_iterator + cbegin() const + { return const_iterator(this->_M_impl._M_node._M_next); } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %list. Iteration is done in ordinary + * element order. + */ + const_iterator + cend() const + { return const_iterator(&this->_M_impl._M_node); } + + /** + * Returns a read-only (constant) reverse iterator that points to + * the last element in the %list. Iteration is done in reverse + * element order. + */ + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + /** + * Returns a read-only (constant) reverse iterator that points to one + * before the first element in the %list. Iteration is done in reverse + * element order. + */ + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // [23.2.2.2] capacity /** * Returns true if the %list is empty. (Thus begin() would equal diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index f4545a02d4e..28b396e31e0 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -340,6 +340,44 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) rend() const { return _M_t.rend(); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * Returns a read-only (constant) iterator that points to the first pair + * in the %map. Iteration is done in ascending order according to the + * keys. + */ + const_iterator + cbegin() const + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * pair in the %map. Iteration is done in ascending order according to + * the keys. + */ + const_iterator + cend() const + { return _M_t.end(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last pair in the %map. Iteration is done in descending order + * according to the keys. + */ + const_reverse_iterator + crbegin() const + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to one + * before the first pair in the %map. Iteration is done in descending + * order according to the keys. + */ + const_reverse_iterator + crend() const + { return _M_t.rend(); } +#endif + // capacity /** Returns true if the %map is empty. (Thus begin() would equal * end().) diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index 864f4b21bbe..1c1883a8651 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -338,6 +338,44 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) rend() const { return _M_t.rend(); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * Returns a read-only (constant) iterator that points to the first pair + * in the %multimap. Iteration is done in ascending order according to + * the keys. + */ + const_iterator + cbegin() const + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * pair in the %multimap. Iteration is done in ascending order according + * to the keys. + */ + const_iterator + cend() const + { return _M_t.end(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last pair in the %multimap. Iteration is done in descending order + * according to the keys. + */ + const_reverse_iterator + crbegin() const + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to one + * before the first pair in the %multimap. Iteration is done in + * descending order according to the keys. + */ + const_reverse_iterator + crend() const + { return _M_t.rend(); } +#endif + // capacity /** Returns true if the %multimap is empty. */ bool diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index 6e45b8fbcb4..55ec0472def 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -248,41 +248,79 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) { return _M_t.get_allocator(); } /** - * Returns a read/write iterator that points to the first element in the - * %multiset. Iteration is done in ascending order according to the - * keys. + * Returns a read-only (constant) iterator that points to the first + * element in the %multiset. Iteration is done in ascending order + * according to the keys. */ iterator begin() const { return _M_t.begin(); } /** - * Returns a read/write iterator that points one past the last element in - * the %multiset. Iteration is done in ascending order according to the - * keys. + * Returns a read-only (constant) iterator that points one past the last + * element in the %multiset. Iteration is done in ascending order + * according to the keys. */ iterator end() const { return _M_t.end(); } /** - * Returns a read/write reverse iterator that points to the last element - * in the %multiset. Iteration is done in descending order according to - * the keys. + * Returns a read-only (constant) reverse iterator that points to the + * last element in the %multiset. Iteration is done in descending order + * according to the keys. */ reverse_iterator rbegin() const { return _M_t.rbegin(); } /** - * Returns a read/write reverse iterator that points to the last element - * in the %multiset. Iteration is done in descending order according to - * the keys. + * Returns a read-only (constant) reverse iterator that points to the + * last element in the %multiset. Iteration is done in descending order + * according to the keys. */ reverse_iterator rend() const { return _M_t.rend(); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %multiset. Iteration is done in ascending order + * according to the keys. + */ + iterator + cbegin() const + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %multiset. Iteration is done in ascending order + * according to the keys. + */ + iterator + cend() const + { return _M_t.end(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last element in the %multiset. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + crbegin() const + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last element in the %multiset. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + crend() const + { return _M_t.rend(); } +#endif + /// Returns true if the %set is empty. bool empty() const diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index 2b51bfaa970..1d628486710 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -255,25 +255,27 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) { return _M_t.get_allocator(); } /** - * Returns a read/write iterator that points to the first element in the - * %set. Iteration is done in ascending order according to the keys. + * Returns a read-only (constant) iterator that points to the first + * element in the %set. Iteration is done in ascending order according + * to the keys. */ iterator begin() const { return _M_t.begin(); } /** - * Returns a read/write iterator that points one past the last element in - * the %set. Iteration is done in ascending order according to the keys. + * Returns a read-only (constant) iterator that points one past the last + * element in the %set. Iteration is done in ascending order according + * to the keys. */ iterator end() const { return _M_t.end(); } /** - * Returns a read/write reverse iterator that points to the last element - * in the %set. Iteration is done in descending order according to the - * keys. + * Returns a read-only (constant) iterator that points to the last + * element in the %set. Iteration is done in descending order according + * to the keys. */ reverse_iterator rbegin() const @@ -281,13 +283,51 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) /** * Returns a read-only (constant) reverse iterator that points to the - * last pair in the %map. Iteration is done in descending order + * last pair in the %set. Iteration is done in descending order * according to the keys. */ reverse_iterator rend() const { return _M_t.rend(); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * Returns a read-only (constant) iterator that points to the first + * element in the %set. Iteration is done in ascending order according + * to the keys. + */ + iterator + cbegin() const + { return _M_t.begin(); } + + /** + * Returns a read-only (constant) iterator that points one past the last + * element in the %set. Iteration is done in ascending order according + * to the keys. + */ + iterator + cend() const + { return _M_t.end(); } + + /** + * Returns a read-only (constant) iterator that points to the last + * element in the %set. Iteration is done in descending order according + * to the keys. + */ + reverse_iterator + crbegin() const + { return _M_t.rbegin(); } + + /** + * Returns a read-only (constant) reverse iterator that points to the + * last pair in the %set. Iteration is done in descending order + * according to the keys. + */ + reverse_iterator + crend() const + { return _M_t.rend(); } +#endif + /// Returns true if the %set is empty. bool empty() const diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index 2f3384d8cc1..745ef79ed10 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -430,6 +430,44 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * Returns a read-only (constant) iterator that points to the + * first element in the %vector. Iteration is done in ordinary + * element order. + */ + const_iterator + cbegin() const + { return const_iterator(this->_M_impl._M_start); } + + /** + * Returns a read-only (constant) iterator that points one past + * the last element in the %vector. Iteration is done in + * ordinary element order. + */ + const_iterator + cend() const + { return const_iterator(this->_M_impl._M_finish); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last element in the %vector. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first element in the %vector. Iteration + * is done in reverse element order. + */ + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // [23.2.4.2] capacity /** Returns the number of elements in the %vector. */ size_type diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque index 47023f8944d..6571d151b1a 100644 --- a/libstdc++-v3/include/debug/deque +++ b/libstdc++-v3/include/debug/deque @@ -166,6 +166,24 @@ namespace __debug rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // 23.2.1.2 capacity: using _Base::size; using _Base::max_size; diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list index a277856c7fc..717433471cb 100644 --- a/libstdc++-v3/include/debug/list +++ b/libstdc++-v3/include/debug/list @@ -195,6 +195,24 @@ namespace __debug rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // 23.2.2.2 capacity: using _Base::empty; using _Base::size; diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h index 11982cf5302..671e1f8365e 100644 --- a/libstdc++-v3/include/debug/map.h +++ b/libstdc++-v3/include/debug/map.h @@ -156,6 +156,24 @@ namespace __debug rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // capacity: using _Base::empty; using _Base::size; diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h index d392f7e554e..1dd4de81df1 100644 --- a/libstdc++-v3/include/debug/multimap.h +++ b/libstdc++-v3/include/debug/multimap.h @@ -155,6 +155,24 @@ namespace __debug rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // capacity: using _Base::empty; using _Base::size; diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h index df9e93ace9b..7c58db17b5c 100644 --- a/libstdc++-v3/include/debug/multiset.h +++ b/libstdc++-v3/include/debug/multiset.h @@ -152,6 +152,24 @@ namespace __debug rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // capacity: using _Base::empty; using _Base::size; diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h index 8554c0f0c90..bebc34c0083 100644 --- a/libstdc++-v3/include/debug/set.h +++ b/libstdc++-v3/include/debug/set.h @@ -152,6 +152,24 @@ namespace __debug rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // capacity: using _Base::empty; using _Base::size; diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector index b010ee00ebb..ce44241004b 100644 --- a/libstdc++-v3/include/debug/vector +++ b/libstdc++-v3/include/debug/vector @@ -181,6 +181,24 @@ namespace __debug rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // 23.2.4.2 capacity: using _Base::size; using _Base::max_size; diff --git a/libstdc++-v3/include/ext/vstring.h b/libstdc++-v3/include/ext/vstring.h index b20faa8f987..1f1965efb3e 100644 --- a/libstdc++-v3/include/ext/vstring.h +++ b/libstdc++-v3/include/ext/vstring.h @@ -327,6 +327,42 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) rend() const { return const_reverse_iterator(this->begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * Returns a read-only (constant) iterator that points to the first + * character in the %string. + */ + const_iterator + cbegin() const + { return const_iterator(this->_M_data()); } + + /** + * Returns a read-only (constant) iterator that points one past the + * last character in the %string. + */ + const_iterator + cend() const + { return const_iterator(this->_M_data() + this->size()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to the last character in the %string. Iteration is done in + * reverse element order. + */ + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(this->end()); } + + /** + * Returns a read-only (constant) reverse iterator that points + * to one before the first character in the %string. Iteration + * is done in reverse element order. + */ + const_reverse_iterator + crend() const + { return const_reverse_iterator(this->begin()); } +#endif + public: // Capacity: /// Returns the number of characters in the string, not including any diff --git a/libstdc++-v3/include/tr1_impl/array b/libstdc++-v3/include/tr1_impl/array index 994d4ddcf6d..759f00e4b5a 100644 --- a/libstdc++-v3/include/tr1_impl/array +++ b/libstdc++-v3/include/tr1_impl/array @@ -97,6 +97,24 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 rend() const { return const_reverse_iterator(begin()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { return const_iterator(&_M_instance[0]); } + + const_iterator + cend() const + { return const_iterator(&_M_instance[_Nm]); } + + const_reverse_iterator + crbegin() const + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const + { return const_reverse_iterator(begin()); } +#endif + // Capacity. size_type size() const { return _Nm; } diff --git a/libstdc++-v3/include/tr1_impl/hashtable b/libstdc++-v3/include/tr1_impl/hashtable index 0255e1a7cb3..1f7deed068a 100644 --- a/libstdc++-v3/include/tr1_impl/hashtable +++ b/libstdc++-v3/include/tr1_impl/hashtable @@ -252,6 +252,21 @@ _GLIBCXX_BEGIN_NAMESPACE_TR1 end() const { return const_iterator(_M_buckets + _M_bucket_count); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + const_iterator + cbegin() const + { + const_iterator __i(_M_buckets); + if (!__i._M_cur_node) + __i._M_incr_bucket(); + return __i; + } + + const_iterator + cend() const + { return const_iterator(_M_buckets + _M_bucket_count); } +#endif + size_type size() const { return _M_element_count; } diff --git a/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc new file mode 100644 index 00000000000..4e2cccf0181 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/array/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::array a; + VERIFY( a.cbegin() == a.begin() ); + VERIFY( a.cend() == a.end() ); + VERIFY( a.crbegin() == a.rbegin() ); + VERIFY( a.crend() == a.rend() ); + VERIFY( a.cbegin() != a.cend() ); + VERIFY( a.crbegin() != a.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc new file mode 100644 index 00000000000..e869a287cb6 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::deque d(7); + VERIFY( d.cbegin() == d.begin() ); + VERIFY( d.cend() == d.end() ); + VERIFY( d.crbegin() == d.rbegin() ); + VERIFY( d.crend() == d.rend() ); + VERIFY( d.cbegin() != d.cend() ); + VERIFY( d.crbegin() != d.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc index 8fde473dc7a..75b656d0a4b 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/assign_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1349 } +// { dg-error "no matching" "" { target *-*-* } 1386 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc index 3124e19af27..f8cdee357db 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1284 } +// { dg-error "no matching" "" { target *-*-* } 1321 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc index 1f6115c5d3c..5e652c69788 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1284 } +// { dg-error "no matching" "" { target *-*-* } 1321 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc index 9d6365932dd..67cb8a625ff 100644 --- a/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/deque/requirements/dr438/insert_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1429 } +// { dg-error "no matching" "" { target *-*-* } 1466 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc new file mode 100644 index 00000000000..d9ef7581e60 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::list l(7); + VERIFY( l.cbegin() == l.begin() ); + VERIFY( l.cend() == l.end() ); + VERIFY( l.crbegin() == l.rbegin() ); + VERIFY( l.crend() == l.rend() ); + VERIFY( l.cbegin() != l.cend() ); + VERIFY( l.crbegin() != l.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc index ccabf384ead..e47411eb1a6 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1188 } +// { dg-error "no matching" "" { target *-*-* } 1226 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc index 0711505092f..69bd5b48ba8 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1157 } +// { dg-error "no matching" "" { target *-*-* } 1195 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc index 1e02ca8913e..49b4f7cd504 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1157 } +// { dg-error "no matching" "" { target *-*-* } 1195 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc index 04b3c2b95c2..af21a0c8902 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1157 } +// { dg-error "no matching" "" { target *-*-* } 1195 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc new file mode 100644 index 00000000000..320d46d2e29 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/requirements/citerators.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::map m; + m[1] = 1; + VERIFY( m.cbegin() == m.begin() ); + VERIFY( m.cend() == m.end() ); + VERIFY( m.crbegin() == m.rbegin() ); + VERIFY( m.crend() == m.rend() ); + VERIFY( m.cbegin() != m.cend() ); + VERIFY( m.crbegin() != m.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc new file mode 100644 index 00000000000..ec01d38afbf --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/requirements/citerators.cc @@ -0,0 +1,55 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::multimap mm_type; + mm_type mm; + mm.insert(mm_type::value_type(1, 1)); + VERIFY( mm.cbegin() == mm.begin() ); + VERIFY( mm.cend() == mm.end() ); + VERIFY( mm.crbegin() == mm.rbegin() ); + VERIFY( mm.crend() == mm.rend() ); + VERIFY( mm.cbegin() != mm.cend() ); + VERIFY( mm.crbegin() != mm.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc new file mode 100644 index 00000000000..48e3d49bcb8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/requirements/citerators.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::multiset ms; + ms.insert(1); + VERIFY( ms.cbegin() == ms.begin() ); + VERIFY( ms.cend() == ms.end() ); + VERIFY( ms.crbegin() == ms.rbegin() ); + VERIFY( ms.crend() == ms.rend() ); + VERIFY( ms.cbegin() != ms.cend() ); + VERIFY( ms.crbegin() != ms.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc new file mode 100644 index 00000000000..3fd624b5208 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/requirements/citerators.cc @@ -0,0 +1,54 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::set s; + s.insert(1); + VERIFY( s.cbegin() == s.begin() ); + VERIFY( s.cend() == s.end() ); + VERIFY( s.crbegin() == s.rbegin() ); + VERIFY( s.crend() == s.rend() ); + VERIFY( s.cbegin() != s.cend() ); + VERIFY( s.crbegin() != s.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc new file mode 100644 index 00000000000..a14ad0e4bb3 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/requirements/citerators.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::unordered_map um; + um[1] = 1; + VERIFY( um.cbegin() == um.begin() ); + VERIFY( um.cend() == um.end() ); + VERIFY( um.cbegin() != um.cend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc new file mode 100644 index 00000000000..9d480726b38 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/requirements/citerators.cc @@ -0,0 +1,52 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + typedef std::unordered_multimap umm_type; + umm_type umm; + umm.insert(umm_type::value_type(1, 1)); + VERIFY( umm.cbegin() == umm.begin() ); + VERIFY( umm.cend() == umm.end() ); + VERIFY( umm.cbegin() != umm.cend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc new file mode 100644 index 00000000000..fd54edc4c95 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/requirements/citerators.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::unordered_multiset ums; + ums.insert(1); + VERIFY( ums.cbegin() == ums.begin() ); + VERIFY( ums.cend() == ums.end() ); + VERIFY( ums.cbegin() != ums.cend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc new file mode 100644 index 00000000000..f358a0f3c7b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/requirements/citerators.cc @@ -0,0 +1,51 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::unordered_set us; + us.insert(1); + VERIFY( us.cbegin() == us.begin() ); + VERIFY( us.cend() == us.end() ); + VERIFY( us.cbegin() != us.cend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc new file mode 100644 index 00000000000..a6ebd177a03 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/bool/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector vb(7); + VERIFY( vb.cbegin() == vb.begin() ); + VERIFY( vb.cend() == vb.end() ); + VERIFY( vb.crbegin() == vb.rbegin() ); + VERIFY( vb.crend() == vb.rend() ); + VERIFY( vb.cbegin() != vb.cend() ); + VERIFY( vb.crbegin() != vb.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc new file mode 100644 index 00000000000..99753389c29 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + std::vector v(7); + VERIFY( v.cbegin() == v.begin() ); + VERIFY( v.cend() == v.end() ); + VERIFY( v.crbegin() == v.rbegin() ); + VERIFY( v.crend() == v.rend() ); + VERIFY( v.cbegin() != v.cend() ); + VERIFY( v.crbegin() != v.crend() ); +} + +int main() +{ + test01(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc index 4239d4df3c5..33c2c04989a 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/assign_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 895 } +// { dg-error "no matching" "" { target *-*-* } 933 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc index 7faf1e2feb6..846cd04e6c6 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_1_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 835 } +// { dg-error "no matching" "" { target *-*-* } 873 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc index 66c0206044e..8dab6ce3195 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/constructor_2_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 835 } +// { dg-error "no matching" "" { target *-*-* } 873 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc index 6aae607479f..b97f22241d9 100644 --- a/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/vector/requirements/dr438/insert_neg.cc @@ -19,7 +19,7 @@ // USA. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 936 } +// { dg-error "no matching" "" { target *-*-* } 974 } // { dg-excess-errors "" } #include diff --git a/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc b/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc new file mode 100644 index 00000000000..3e579e80fca --- /dev/null +++ b/libstdc++-v3/testsuite/ext/vstring/requirements/citerators.cc @@ -0,0 +1,53 @@ +// { dg-options "-std=gnu++0x" } + +// 2007-10-15 Paolo Carlini + +// Copyright (C) 2007 Free Software Foundation, Inc. +// +// 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. + +#include +#include + +void +test01() +{ + bool test __attribute__((unused)) = true; + + __gnu_cxx::__vstring v(7, 'a'); + VERIFY( v.cbegin() == v.begin() ); + VERIFY( v.cend() == v.end() ); + VERIFY( v.crbegin() == v.rbegin() ); + VERIFY( v.crend() == v.rend() ); + VERIFY( v.cbegin() != v.cend() ); + VERIFY( v.crbegin() != v.crend() ); +} + +int main() +{ + test01(); + return 0; +}