basic_string.h (basic_string): Add cbegin(), cend(), crbegin(), crend() in C++0x mode.
2009-08-25 Benjamin Kosnik <bkoz@redhat.com> * include/bits/basic_string.h (basic_string): Add cbegin(), cend(), crbegin(), crend() in C++0x mode. * config/abi/pre/gnu.ver: Add exports. * testsuite/util/testsuite_containers.h: New. * testsuite/util/testsuite_container_traits.h: New. * testsuite/21_strings/basic_string/requirements/citerators.cc: New. * testsuite/21_strings/basic_string/requirements/typedefs.cc: New. * testsuite/ext/vstring/requirements/citerators.cc: Edit. * testsuite/ext/vstring/requirements/typedefs.cc: New. * testsuite/23_containers/unordered_map/requirements/ cliterators.cc: Edit. * testsuite/23_containers/unordered_map/requirements/ citerators.cc: Edit. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/1.cc: New. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/2.cc: New. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/3.cc: New. * testsuite/23_containers/unordered_map/requirements/typedefs.cc: Edit. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation.cc: Move to nested directory. * testsuite/23_containers/queue/requirements/typedefs.cc: New. * testsuite/23_containers/priority_queue/requirements/typedefs.cc: New. * testsuite/23_containers/multimap/requirements/citerators.cc: Edit. * testsuite/23_containers/multimap/requirements/typedefs.cc: New. * testsuite/23_containers/set/requirements/citerators.cc: Edit. * testsuite/23_containers/set/requirements/typedefs.cc: New. * testsuite/23_containers/unordered_multimap/requirements/ cliterators.cc: Edit. * testsuite/23_containers/unordered_multimap/requirements/ citerators.cc: Edit. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/1.cc: New. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/2.cc: Edit.: New. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/3.cc: New. * testsuite/23_containers/unordered_multimap/requirements/ typedefs.cc: Edit. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation.cc: Move to nested. * testsuite/23_containers/forward_list/requirements/citerators.cc: New. * testsuite/23_containers/forward_list/requirements/1.cc: Remove. * testsuite/23_containers/forward_list/requirements/dr438/ insert_neg.cc: New. * testsuite/23_containers/forward_list/requirements/dr438/ assign_neg.cc: New. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_1_neg.cc: New. * testsuite/23_containers/forward_list/requirements/dr438/ constructor_2_neg.cc: New. * testsuite/23_containers/forward_list/requirements/dr438/ constructor.cc: New. * testsuite/23_containers/forward_list/requirements/typedefs.cc: New. * testsuite/23_containers/unordered_set/requirements/ cliterators.cc: Edit. * testsuite/23_containers/unordered_set/requirements/ citerators.cc: Edit. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/1.cc: New. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/2.cc: New. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/3.cc: New. * testsuite/23_containers/unordered_set/requirements/typedefs.cc: Edit. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation.cc: Move to nested. * testsuite/23_containers/vector/requirements/citerators.cc: Edit. * testsuite/23_containers/vector/requirements/dr438/bool/ constructor.cc: Move. * testsuite/23_containers/vector/requirements/typedefs.cc: New. * testsuite/23_containers/vector/bool/requirements/citerators.cc: Edit. * testsuite/23_containers/vector/bool/requirements/dr438/ constructor.cc: New. * testsuite/23_containers/deque/requirements/citerators.cc: Edit. * testsuite/23_containers/deque/requirements/typedefs.cc * testsuite/23_containers/stack/requirements/typedefs.cc * testsuite/23_containers/multiset/requirements/citerators.cc: Edit. * testsuite/23_containers/multiset/requirements/typedefs.cc: New. * testsuite/23_containers/list/requirements/citerators.cc: Edit. * testsuite/23_containers/list/requirements/typedefs.cc: New. * testsuite/23_containers/unordered_multiset/requirements/ cliterators.cc: Edit. * testsuite/23_containers/unordered_multiset/requirements/ citerators.cc: Edit. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation.cc: Move. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/1.cc: New. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/2.cc: New. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/3.cc: New. * testsuite/23_containers/unordered_multiset/requirements/typedefs.cc * testsuite/23_containers/map/requirements/citerators.cc: Edit. * testsuite/23_containers/map/requirements/typedefs.cc: New. * testsuite/23_containers/array/requirements/citerators.cc: Edit. * testsuite/23_containers/array/requirements/explicit_instantiation.cc: Move. * testsuite/23_containers/array/requirements/ explicit_instantiation/1.cc: New. * testsuite/23_containers/array/requirements/ explicit_instantiation/2.cc: New. * testsuite/23_containers/array/requirements/typedefs.cc: New. From-SVN: r151106
This commit is contained in:
parent
5c1a2bb1fc
commit
439a0f5a2a
64 changed files with 1509 additions and 487 deletions
|
@ -1,3 +1,112 @@
|
|||
2009-08-25 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* include/bits/basic_string.h (basic_string): Add cbegin(),
|
||||
cend(), crbegin(), crend() in C++0x mode.
|
||||
* config/abi/pre/gnu.ver: Add exports.
|
||||
|
||||
* testsuite/util/testsuite_containers.h: New.
|
||||
* testsuite/util/testsuite_container_traits.h: New.
|
||||
* testsuite/21_strings/basic_string/requirements/citerators.cc: New.
|
||||
* testsuite/21_strings/basic_string/requirements/typedefs.cc: New.
|
||||
* testsuite/ext/vstring/requirements/citerators.cc: Edit.
|
||||
* testsuite/ext/vstring/requirements/typedefs.cc: New.
|
||||
* testsuite/23_containers/unordered_map/requirements/
|
||||
cliterators.cc: Edit.
|
||||
* testsuite/23_containers/unordered_map/requirements/
|
||||
citerators.cc: Edit.
|
||||
* testsuite/23_containers/unordered_map/requirements/
|
||||
explicit_instantiation/1.cc: New.
|
||||
* testsuite/23_containers/unordered_map/requirements/
|
||||
explicit_instantiation/2.cc: New.
|
||||
* testsuite/23_containers/unordered_map/requirements/
|
||||
explicit_instantiation/3.cc: New.
|
||||
* testsuite/23_containers/unordered_map/requirements/typedefs.cc: Edit.
|
||||
* testsuite/23_containers/unordered_map/requirements/
|
||||
explicit_instantiation.cc: Move to nested directory.
|
||||
* testsuite/23_containers/queue/requirements/typedefs.cc: New.
|
||||
* testsuite/23_containers/priority_queue/requirements/typedefs.cc: New.
|
||||
* testsuite/23_containers/multimap/requirements/citerators.cc: Edit.
|
||||
* testsuite/23_containers/multimap/requirements/typedefs.cc: New.
|
||||
* testsuite/23_containers/set/requirements/citerators.cc: Edit.
|
||||
* testsuite/23_containers/set/requirements/typedefs.cc: New.
|
||||
* testsuite/23_containers/unordered_multimap/requirements/
|
||||
cliterators.cc: Edit.
|
||||
* testsuite/23_containers/unordered_multimap/requirements/
|
||||
citerators.cc: Edit.
|
||||
* testsuite/23_containers/unordered_multimap/requirements/
|
||||
explicit_instantiation/1.cc: New.
|
||||
* testsuite/23_containers/unordered_multimap/requirements/
|
||||
explicit_instantiation/2.cc: Edit.: New.
|
||||
* testsuite/23_containers/unordered_multimap/requirements/
|
||||
explicit_instantiation/3.cc: New.
|
||||
* testsuite/23_containers/unordered_multimap/requirements/
|
||||
typedefs.cc: Edit.
|
||||
* testsuite/23_containers/unordered_multimap/requirements/
|
||||
explicit_instantiation.cc: Move to nested.
|
||||
* testsuite/23_containers/forward_list/requirements/citerators.cc: New.
|
||||
* testsuite/23_containers/forward_list/requirements/1.cc: Remove.
|
||||
* testsuite/23_containers/forward_list/requirements/dr438/
|
||||
insert_neg.cc: New.
|
||||
* testsuite/23_containers/forward_list/requirements/dr438/
|
||||
assign_neg.cc: New.
|
||||
* testsuite/23_containers/forward_list/requirements/dr438/
|
||||
constructor_1_neg.cc: New.
|
||||
* testsuite/23_containers/forward_list/requirements/dr438/
|
||||
constructor_2_neg.cc: New.
|
||||
* testsuite/23_containers/forward_list/requirements/dr438/
|
||||
constructor.cc: New.
|
||||
* testsuite/23_containers/forward_list/requirements/typedefs.cc: New.
|
||||
* testsuite/23_containers/unordered_set/requirements/
|
||||
cliterators.cc: Edit.
|
||||
* testsuite/23_containers/unordered_set/requirements/
|
||||
citerators.cc: Edit.
|
||||
* testsuite/23_containers/unordered_set/requirements/
|
||||
explicit_instantiation/1.cc: New.
|
||||
* testsuite/23_containers/unordered_set/requirements/
|
||||
explicit_instantiation/2.cc: New.
|
||||
* testsuite/23_containers/unordered_set/requirements/
|
||||
explicit_instantiation/3.cc: New.
|
||||
* testsuite/23_containers/unordered_set/requirements/typedefs.cc: Edit.
|
||||
* testsuite/23_containers/unordered_set/requirements/
|
||||
explicit_instantiation.cc: Move to nested.
|
||||
* testsuite/23_containers/vector/requirements/citerators.cc: Edit.
|
||||
* testsuite/23_containers/vector/requirements/dr438/bool/
|
||||
constructor.cc: Move.
|
||||
* testsuite/23_containers/vector/requirements/typedefs.cc: New.
|
||||
* testsuite/23_containers/vector/bool/requirements/citerators.cc: Edit.
|
||||
* testsuite/23_containers/vector/bool/requirements/dr438/
|
||||
constructor.cc: New.
|
||||
* testsuite/23_containers/deque/requirements/citerators.cc: Edit.
|
||||
* testsuite/23_containers/deque/requirements/typedefs.cc
|
||||
* testsuite/23_containers/stack/requirements/typedefs.cc
|
||||
* testsuite/23_containers/multiset/requirements/citerators.cc: Edit.
|
||||
* testsuite/23_containers/multiset/requirements/typedefs.cc: New.
|
||||
* testsuite/23_containers/list/requirements/citerators.cc: Edit.
|
||||
* testsuite/23_containers/list/requirements/typedefs.cc: New.
|
||||
* testsuite/23_containers/unordered_multiset/requirements/
|
||||
cliterators.cc: Edit.
|
||||
* testsuite/23_containers/unordered_multiset/requirements/
|
||||
citerators.cc: Edit.
|
||||
* testsuite/23_containers/unordered_multiset/requirements/
|
||||
explicit_instantiation.cc: Move.
|
||||
* testsuite/23_containers/unordered_multiset/requirements/
|
||||
explicit_instantiation/1.cc: New.
|
||||
* testsuite/23_containers/unordered_multiset/requirements/
|
||||
explicit_instantiation/2.cc: New.
|
||||
* testsuite/23_containers/unordered_multiset/requirements/
|
||||
explicit_instantiation/3.cc: New.
|
||||
* testsuite/23_containers/unordered_multiset/requirements/typedefs.cc
|
||||
* testsuite/23_containers/map/requirements/citerators.cc: Edit.
|
||||
* testsuite/23_containers/map/requirements/typedefs.cc: New.
|
||||
* testsuite/23_containers/array/requirements/citerators.cc: Edit.
|
||||
* testsuite/23_containers/array/requirements/explicit_instantiation.cc:
|
||||
Move.
|
||||
* testsuite/23_containers/array/requirements/
|
||||
explicit_instantiation/1.cc: New.
|
||||
* testsuite/23_containers/array/requirements/
|
||||
explicit_instantiation/2.cc: New.
|
||||
* testsuite/23_containers/array/requirements/typedefs.cc: New.
|
||||
|
||||
2009-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||
|
||||
* configure.ac (AC_PREREQ): Bump to 2.64.
|
||||
|
@ -76,7 +185,7 @@
|
|||
|
||||
PR libstdc++/41061
|
||||
* include/bits/random.h (operator<<(std::basic_ostream<>&,
|
||||
const std::lognormal_distribution<>&),
|
||||
const std::lognormal_distribution<>&),
|
||||
operator>>(std::basic_istream<>&, std::lognormal_distribution<>&),
|
||||
operator<<(std::basic_ostream<>&, const std::gamma_distribution<>&),
|
||||
operator>>(std::basic_istream<>&, std::gamma_distribution<>&),
|
||||
|
@ -257,12 +366,12 @@
|
|||
2009-08-06 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* src/compatibility.cc: Make C++0x safe, add in explicit casts to
|
||||
bool for stream sentry objects.
|
||||
* include/bits/istream.tcc: Same.
|
||||
* include/bits/ostream.tcc: Same.
|
||||
* include/bits/basic_string.tcc: Same.
|
||||
bool for stream sentry objects.
|
||||
* include/bits/istream.tcc: Same.
|
||||
* include/bits/ostream.tcc: Same.
|
||||
* include/bits/basic_string.tcc: Same.
|
||||
* include/bits/ostream_insert.h: Same.
|
||||
* src/istream.cc: Same.
|
||||
* src/istream.cc: Same.
|
||||
|
||||
2009-08-04 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
|
@ -1105,7 +1214,7 @@
|
|||
const param_type&): Define here.
|
||||
(geometric_distribution<>::operator()(_UniformRandomNumberGenerator&,
|
||||
const param_type&), discrete_distribution<>::operator()
|
||||
(_UniformRandomNumberGenerator&, const param_type&),
|
||||
(_UniformRandomNumberGenerator&, const param_type&),
|
||||
piecewise_constant_distribution<>::operator()
|
||||
(_UniformRandomNumberGenerator&, const param_type&),
|
||||
piecewise_linear_distribution<>::operator()
|
||||
|
|
|
@ -193,7 +193,8 @@ GLIBCXX_3.4 {
|
|||
_ZNSsaSE[PRc]*;
|
||||
_ZNSsixE*;
|
||||
_ZNSspLE[PRc]*;
|
||||
_ZNKSs[0-9][a-z]*;
|
||||
_ZNKSs[0-9][a-b]*;
|
||||
_ZNKSs[0-9][d-z]*;
|
||||
_ZNKSs[0-9][0-9][a-z]*;
|
||||
_ZNKSs[a-z]*;
|
||||
_ZNKSs4_Rep12_M_is_leakedEv;
|
||||
|
@ -205,12 +206,17 @@ GLIBCXX_3.4 {
|
|||
_ZNKSs8_M_limit*;
|
||||
_ZNKSs9_M_ibeginEv;
|
||||
_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_E*;
|
||||
_ZNKSs7compare*;
|
||||
_ZNKSs5c_strEv;
|
||||
_ZNKSs8capacityEv;
|
||||
_ZNKSs4copyEPcmm;
|
||||
|
||||
# std::wstring
|
||||
_ZNSbIwSt11char_traitsIwESaIwEEC[12][EI][PRjmvN]*;
|
||||
_ZNSbIwSt11char_traitsIwESaIwEED*;
|
||||
_ZNSbIwSt11char_traitsIwESaIwEE[0-58-9][a-z]*;
|
||||
_ZNSbIwSt11char_traitsIwESaIwEE[67][a-z]*E[PRwjmv]*;
|
||||
_ZNSbIwSt11char_traitsIwESaIwEE[67][a-b]*E[PRwjmv]*;
|
||||
_ZNSbIwSt11char_traitsIwESaIwEE[67][d-z]*E[PRwjmv]*;
|
||||
_ZNSbIwSt11char_traitsIwESaIwEE7[a-z]*EES6_[NPRjm]*;
|
||||
_ZNSbIwSt11char_traitsIwESaIwEE7[a-z]*EES6_S[56]*;
|
||||
_ZNSbIwSt11char_traitsIwESaIwEE12_Alloc_hiderC*;
|
||||
|
@ -250,6 +256,7 @@ GLIBCXX_3.4 {
|
|||
_ZNKSbIwSt11char_traitsIwESaIwEE8_M_limit*;
|
||||
_ZNKSbIwSt11char_traitsIwESaIwEE9_M_ibeginEv;
|
||||
_ZStplIwSt11char_traitsIwESaIwEESbIT_T0_T1_E*;
|
||||
_ZNKSbIwSt11char_traitsIwESaIwEE7compare*;
|
||||
|
||||
# std::basic_streambuf
|
||||
_ZNSt15basic_streambufI[cw]St11char_traitsI[cw]EE[CD]*;
|
||||
|
@ -980,6 +987,16 @@ GLIBCXX_3.4.13 {
|
|||
_ZTISt12future_error;
|
||||
_ZSt20__throw_future_errori;
|
||||
|
||||
# string|wstring ::cbegin member functions
|
||||
_ZNKSs6cbeginEv;
|
||||
_ZNKSs4cendEv;
|
||||
_ZNKSs7crbeginEv;
|
||||
_ZNKSs5crendEv;
|
||||
_ZNKSbIwSt11char_traitsIwESaIwEE4cendEv;
|
||||
_ZNKSbIwSt11char_traitsIwESaIwEE6cbeginEv;
|
||||
_ZNKSbIwSt11char_traitsIwESaIwEE7crbeginEv;
|
||||
_ZNKSbIwSt11char_traitsIwESaIwEE5crendEv;
|
||||
|
||||
} GLIBCXX_3.4.12;
|
||||
|
||||
# Symbols in the support library (libsupc++) have their own tag.
|
||||
|
|
|
@ -620,6 +620,42 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
|
|||
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
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-require-string-conversions "" }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <string>
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
__gnu_test::citerator<std::string> test1;
|
||||
__gnu_test::citerator<std::wstring> test2;
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <string>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::string> t1;
|
||||
__gnu_test::types<std::wstring> t2;
|
|
@ -19,26 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <array>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::array<int, 7> 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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::array<int, 7> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
// along with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <array>
|
||||
|
||||
template class std::array<int, 5>;
|
|
@ -0,0 +1,27 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// This file tests explicit instantiation of library containers
|
||||
|
||||
#include <array>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_api.h>
|
||||
|
||||
template class std::array<__gnu_test::NonDefaultConstructible, 3>;
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <array>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::array<int, 10> > t;
|
|
@ -19,26 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <deque>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::deque<int> 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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::deque<int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <deque>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::deque<int> > t;
|
|
@ -1,69 +0,0 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// Copyright (C) 2008, 2009 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 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without Pred 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 23.2.3.n forward_list xxx [lib.forward_list.xxx]
|
||||
|
||||
#include <forward_list>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
// A nontrivial type.
|
||||
template<typename T>
|
||||
struct A { };
|
||||
|
||||
// Another nontrivial type
|
||||
struct B { };
|
||||
|
||||
// A nontrivial type convertible from an int
|
||||
struct C
|
||||
{
|
||||
C(int i) : i_(i) { }
|
||||
bool operator==(const C& rhs) { return i_ == rhs.i_; }
|
||||
int i_;
|
||||
};
|
||||
|
||||
// This test verifies the following.
|
||||
//
|
||||
void
|
||||
test01()
|
||||
{
|
||||
std::forward_list< A<B> > lst;
|
||||
VERIFY(lst.begin() == lst.end());
|
||||
VERIFY(std::distance(lst.begin(), lst.end()) == 0);
|
||||
|
||||
// check type definitions -- will fail compile if missing
|
||||
typedef std::forward_list< A<B> >::reference reference;
|
||||
typedef std::forward_list< A<B> >::const_reference const_reference;
|
||||
typedef std::forward_list< A<B> >::iterator iterator;
|
||||
typedef std::forward_list< A<B> >::const_iterator const_iterator;
|
||||
typedef std::forward_list< A<B> >::size_type size_type;
|
||||
typedef std::forward_list< A<B> >::difference_type difference_type;
|
||||
typedef std::forward_list< A<B> >::value_type value_type;
|
||||
typedef std::forward_list< A<B> >::allocator_type allocator_type;
|
||||
typedef std::forward_list< A<B> >::pointer pointer;
|
||||
typedef std::forward_list< A<B> >::const_pointer const_pointer;
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
test01();
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <forward_list>
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
namespace __gnu_test
|
||||
{
|
||||
template<>
|
||||
struct populate<std::forward_list<int>, true>
|
||||
{
|
||||
populate(std::forward_list<int>& container)
|
||||
{
|
||||
container.push_front(1);
|
||||
container.push_front(2);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
typedef std::forward_list<int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-error "no matching" "" { target *-*-* } 1209 }
|
||||
// { dg-excess-errors "" }
|
||||
|
||||
// Copyright (C) 2009 Free Software Foundation
|
||||
//
|
||||
// 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <forward_list>
|
||||
|
||||
struct A
|
||||
{
|
||||
explicit A(int) { }
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
typedef std::forward_list<A> test_type;
|
||||
test_type l;
|
||||
l.assign(10, 1);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
|
||||
// Copyright (C) 2009 Free Software Foundation
|
||||
//
|
||||
// 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <forward_list>
|
||||
|
||||
void f()
|
||||
{
|
||||
typedef std::forward_list<int> test_type;
|
||||
test_type l(10, 1);
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-error "no matching" "" { target *-*-* } 1209 }
|
||||
// { dg-excess-errors "" }
|
||||
|
||||
// Copyright (C) 2009 Free Software Foundation
|
||||
//
|
||||
// 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <forward_list>
|
||||
|
||||
void f()
|
||||
{
|
||||
typedef std::forward_list<std::forward_list<int> > test_type;
|
||||
test_type l(10, 1);
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-error "no matching" "" { target *-*-* } 1209 }
|
||||
// { dg-excess-errors "" }
|
||||
|
||||
// Copyright (C) 2009 Free Software Foundation
|
||||
//
|
||||
// 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <forward_list>
|
||||
#include <utility>
|
||||
|
||||
void f()
|
||||
{
|
||||
typedef std::forward_list<std::forward_list<std::pair<char, char> > > test_type;
|
||||
test_type l('a', 'b');
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-error "no matching" "" { target *-*-* } 1209 }
|
||||
// { dg-excess-errors "" }
|
||||
|
||||
// Copyright (C) 2009 Free Software Foundation
|
||||
//
|
||||
// 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <forward_list>
|
||||
|
||||
struct A
|
||||
{
|
||||
explicit A(int) { }
|
||||
};
|
||||
|
||||
void f()
|
||||
{
|
||||
typedef std::forward_list<A> test_type;
|
||||
test_type l;
|
||||
l.insert_after(l.begin(), 10, 1);
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <forward_list>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::forward_list<int> > t;
|
|
@ -19,28 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <list>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef std::list<int> list_type;
|
||||
list_type 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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::list<int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <list>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::list<int> > t;
|
|
@ -19,27 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::map<int, int> 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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::map<int, int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <map>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::map<int, long> > t;
|
|
@ -19,28 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <map>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef std::multimap<int, int> 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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::multimap<int, int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <map>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::multimap<int, long> > t;
|
|
@ -19,27 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <set>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::multiset<int> 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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::multiset<int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <set>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::multiset<int> > t;
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <queue>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::priority_queue<int> > t;
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <queue>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::queue<int> > t;
|
|
@ -19,27 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <set>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::set<int> 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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::set<int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <set>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::set<int> > t;
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <stack>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::stack<int> > t;
|
|
@ -19,24 +19,13 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <unordered_map>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::unordered_map<int, int> um;
|
||||
um[1] = 1;
|
||||
VERIFY( um.cbegin() == um.begin() );
|
||||
VERIFY( um.cend() == um.end() );
|
||||
VERIFY( um.cbegin() != um.cend() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::unordered_map<int, int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,26 +19,14 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <unordered_map>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// DR 691.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef std::unordered_map<int, int> um_type;
|
||||
um_type um;
|
||||
um[1] = 1;
|
||||
VERIFY( um.cbegin(0) == um.begin(0) );
|
||||
VERIFY( um.cend(0) == um.end(0) );
|
||||
const um_type::size_type bn = um.bucket(1);
|
||||
VERIFY( um.cbegin(bn) != um.cend(bn) );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::unordered_map<int, int> test_type;
|
||||
typedef typename test_type::value_type value_type;
|
||||
value_type v(1, 1);
|
||||
__gnu_test::forward_members_unordered<test_type> test(v);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// This file tests explicit instantiation of library containers
|
||||
|
||||
#include <unordered_map>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_api.h>
|
||||
|
||||
typedef __gnu_test::NonDefaultConstructible inst_type;
|
||||
template class std::unordered_map<inst_type, inst_type>;
|
|
@ -0,0 +1,24 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std;
|
||||
template class unordered_map<int, int, hash<int>, equal_to<int>, allocator<char>>;
|
|
@ -1,9 +1,7 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 2008-08-27 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008, 2009 Free Software Foundation
|
||||
// Copyright (C) 2009 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
|
||||
|
@ -20,27 +18,8 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <unordered_map>
|
||||
|
||||
void test01()
|
||||
{
|
||||
// Check for required typedefs
|
||||
typedef std::unordered_map<int, int> test_type;
|
||||
|
||||
typedef test_type::key_type key_type;
|
||||
typedef test_type::value_type value_type;
|
||||
typedef test_type::mapped_type mapped_type;
|
||||
typedef test_type::hasher hasher;
|
||||
typedef test_type::key_equal key_equal;
|
||||
typedef test_type::allocator_type allocator_type;
|
||||
typedef test_type::pointer pointer;
|
||||
typedef test_type::const_pointer const_pointer;
|
||||
typedef test_type::reference reference;
|
||||
typedef test_type::const_reference const_reference;
|
||||
typedef test_type::size_type size_type;
|
||||
typedef test_type::difference_type difference_type;
|
||||
typedef test_type::iterator iterator;
|
||||
typedef test_type::const_iterator const_iterator;
|
||||
typedef test_type::local_iterator local_iterator;
|
||||
typedef test_type::const_local_iterator const_local_iterator;
|
||||
}
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::unordered_map<int, long> > t;
|
||||
|
|
|
@ -19,25 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <unordered_map>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef std::unordered_multimap<int, int> 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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::unordered_multimap<int, int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -19,26 +19,14 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <unordered_map>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// DR 691.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef std::unordered_multimap<int, int> umm_type;
|
||||
umm_type umm;
|
||||
umm.insert(umm_type::value_type(1, 1));
|
||||
VERIFY( umm.cbegin(0) == umm.begin(0) );
|
||||
VERIFY( umm.cend(0) == umm.end(0) );
|
||||
const umm_type::size_type bn = umm.bucket(1);
|
||||
VERIFY( umm.cbegin(bn) != umm.cend(bn) );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::unordered_multimap<int, int> test_type;
|
||||
typedef typename test_type::value_type value_type;
|
||||
value_type v(1, 1);
|
||||
__gnu_test::forward_members_unordered<test_type> test(v);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// This file tests explicit instantiation of library containers
|
||||
|
||||
#include <unordered_map>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_api.h>
|
||||
|
||||
typedef __gnu_test::NonDefaultConstructible inst_type;
|
||||
template class std::unordered_multimap<inst_type, inst_type>;
|
|
@ -0,0 +1,24 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
using namespace std;
|
||||
template class unordered_multimap<int, int, hash<int>, equal_to<int>, allocator<char>>;
|
|
@ -1,9 +1,7 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 2008-08-27 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008, 2009 Free Software Foundation
|
||||
// Copyright (C) 2009 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
|
||||
|
@ -20,27 +18,8 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <unordered_map>
|
||||
|
||||
void test01()
|
||||
{
|
||||
// Check for required typedefs
|
||||
typedef std::unordered_multimap<int, int> test_type;
|
||||
|
||||
typedef test_type::key_type key_type;
|
||||
typedef test_type::value_type value_type;
|
||||
typedef test_type::mapped_type mapped_type;
|
||||
typedef test_type::hasher hasher;
|
||||
typedef test_type::key_equal key_equal;
|
||||
typedef test_type::allocator_type allocator_type;
|
||||
typedef test_type::pointer pointer;
|
||||
typedef test_type::const_pointer const_pointer;
|
||||
typedef test_type::reference reference;
|
||||
typedef test_type::const_reference const_reference;
|
||||
typedef test_type::size_type size_type;
|
||||
typedef test_type::difference_type difference_type;
|
||||
typedef test_type::iterator iterator;
|
||||
typedef test_type::const_iterator const_iterator;
|
||||
typedef test_type::local_iterator local_iterator;
|
||||
typedef test_type::const_local_iterator const_local_iterator;
|
||||
}
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::unordered_multimap<int, long> > t;
|
||||
|
|
|
@ -19,24 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <unordered_set>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::unordered_multiset<int> ums;
|
||||
ums.insert(1);
|
||||
VERIFY( ums.cbegin() == ums.begin() );
|
||||
VERIFY( ums.cend() == ums.end() );
|
||||
VERIFY( ums.cbegin() != ums.cend() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::unordered_multiset<int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -19,26 +19,14 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <unordered_set>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// DR 691.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef std::unordered_multiset<int> ums_type;
|
||||
ums_type ums;
|
||||
ums.insert(1);
|
||||
VERIFY( ums.cbegin(0) == ums.begin(0) );
|
||||
VERIFY( ums.cend(0) == ums.end(0) );
|
||||
const ums_type::size_type bn = ums.bucket(1);
|
||||
VERIFY( ums.cbegin(bn) != ums.cend(bn) );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::unordered_multiset<int> test_type;
|
||||
typedef typename test_type::value_type value_type;
|
||||
value_type v(1);
|
||||
__gnu_test::forward_members_unordered<test_type> test(v);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// This file tests explicit instantiation of library containers
|
||||
|
||||
#include <unordered_set>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_api.h>
|
||||
|
||||
template class std::unordered_multiset<__gnu_test::NonDefaultConstructible>;
|
|
@ -0,0 +1,24 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
using namespace std;
|
||||
template class unordered_multiset<int, hash<int>, equal_to<int>, allocator<char>>;
|
|
@ -1,9 +1,7 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 2008-08-27 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008, 2009 Free Software Foundation
|
||||
// Copyright (C) 2009 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
|
||||
|
@ -20,26 +18,8 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <unordered_set>
|
||||
|
||||
void test01()
|
||||
{
|
||||
// Check for required typedefs
|
||||
typedef std::unordered_multiset<int> test_type;
|
||||
|
||||
typedef test_type::key_type key_type;
|
||||
typedef test_type::value_type value_type;
|
||||
typedef test_type::hasher hasher;
|
||||
typedef test_type::key_equal key_equal;
|
||||
typedef test_type::allocator_type allocator_type;
|
||||
typedef test_type::pointer pointer;
|
||||
typedef test_type::const_pointer const_pointer;
|
||||
typedef test_type::reference reference;
|
||||
typedef test_type::const_reference const_reference;
|
||||
typedef test_type::size_type size_type;
|
||||
typedef test_type::difference_type difference_type;
|
||||
typedef test_type::iterator iterator;
|
||||
typedef test_type::const_iterator const_iterator;
|
||||
typedef test_type::local_iterator local_iterator;
|
||||
typedef test_type::const_local_iterator const_local_iterator;
|
||||
}
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::unordered_multiset<int> > t;
|
||||
|
|
|
@ -19,24 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <unordered_set>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::unordered_set<int> us;
|
||||
us.insert(1);
|
||||
VERIFY( us.cbegin() == us.begin() );
|
||||
VERIFY( us.cend() == us.end() );
|
||||
VERIFY( us.cbegin() != us.cend() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::unordered_set<int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -19,26 +19,14 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <unordered_set>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
// DR 691.
|
||||
void test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
typedef std::unordered_set<int> us_type;
|
||||
us_type us;
|
||||
us.insert(1);
|
||||
VERIFY( us.cbegin(0) == us.begin(0) );
|
||||
VERIFY( us.cend(0) == us.end(0) );
|
||||
const us_type::size_type bn = us.bucket(1);
|
||||
VERIFY( us.cbegin(bn) != us.cend(bn) );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::unordered_set<int> test_type;
|
||||
typedef typename test_type::value_type value_type;
|
||||
value_type v(1);
|
||||
__gnu_test::forward_members_unordered<test_type> test(v);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
// This file tests explicit instantiation of library containers
|
||||
|
||||
#include <unordered_set>
|
||||
#include <testsuite_hooks.h>
|
||||
#include <testsuite_api.h>
|
||||
|
||||
template class std::unordered_set<__gnu_test::NonDefaultConstructible>;
|
|
@ -0,0 +1,24 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2007, 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
using namespace std;
|
||||
template class unordered_set<int, hash<int>, equal_to<int>, allocator<char>>;
|
|
@ -1,9 +1,7 @@
|
|||
// { dg-do compile }
|
||||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// 2008-08-27 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
// Copyright (C) 2008, 2009 Free Software Foundation
|
||||
// Copyright (C) 2009 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
|
||||
|
@ -20,26 +18,8 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <unordered_set>
|
||||
|
||||
void test01()
|
||||
{
|
||||
// Check for required typedefs
|
||||
typedef std::unordered_set<int> test_type;
|
||||
|
||||
typedef test_type::key_type key_type;
|
||||
typedef test_type::value_type value_type;
|
||||
typedef test_type::hasher hasher;
|
||||
typedef test_type::key_equal key_equal;
|
||||
typedef test_type::allocator_type allocator_type;
|
||||
typedef test_type::pointer pointer;
|
||||
typedef test_type::const_pointer const_pointer;
|
||||
typedef test_type::reference reference;
|
||||
typedef test_type::const_reference const_reference;
|
||||
typedef test_type::size_type size_type;
|
||||
typedef test_type::difference_type difference_type;
|
||||
typedef test_type::iterator iterator;
|
||||
typedef test_type::const_iterator const_iterator;
|
||||
typedef test_type::local_iterator local_iterator;
|
||||
typedef test_type::const_local_iterator const_local_iterator;
|
||||
}
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::unordered_set<int> > t;
|
||||
|
|
|
@ -19,26 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::vector<bool> 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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::vector<bool> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -19,26 +19,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
void
|
||||
test01()
|
||||
{
|
||||
bool test __attribute__((unused)) = true;
|
||||
|
||||
std::vector<int> 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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef std::vector<int> test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <vector>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<std::vector<int> > t;
|
|
@ -20,26 +20,12 @@
|
|||
// with this library; see the file COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include <ext/vstring.h>
|
||||
#include <testsuite_hooks.h>
|
||||
|
||||
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() );
|
||||
}
|
||||
#include <testsuite_containers.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
test01();
|
||||
typedef __gnu_cxx::__vstring test_type;
|
||||
__gnu_test::citerator<test_type> test;
|
||||
return 0;
|
||||
}
|
||||
|
|
25
libstdc++-v3/testsuite/ext/vstring/requirements/typedefs.cc
Normal file
25
libstdc++-v3/testsuite/ext/vstring/requirements/typedefs.cc
Normal file
|
@ -0,0 +1,25 @@
|
|||
// { dg-options "-std=gnu++0x" }
|
||||
// { dg-do compile }
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <testsuite_containers.h>
|
||||
#include <ext/vstring.h>
|
||||
|
||||
// Check container for required typedefs.
|
||||
__gnu_test::types<__gnu_cxx::__vstring> t;
|
207
libstdc++-v3/testsuite/util/testsuite_container_traits.h
Normal file
207
libstdc++-v3/testsuite/util/testsuite_container_traits.h
Normal file
|
@ -0,0 +1,207 @@
|
|||
// -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef _GLIBCXX_TESTSUITE_CONTAINER_TRAITS_H
|
||||
#define _GLIBCXX_TESTSUITE_CONTAINER_TRAITS_H
|
||||
|
||||
#include <bits/stdc++.h>
|
||||
#include <ext/vstring.h>
|
||||
|
||||
namespace __gnu_test
|
||||
{
|
||||
// Container traits.
|
||||
struct traits_base
|
||||
{
|
||||
// Type, nested type, and typedef related traits.
|
||||
typedef std::false_type is_container;
|
||||
typedef std::false_type is_adaptor;
|
||||
typedef std::false_type is_reversible;
|
||||
typedef std::false_type is_allocator_aware;
|
||||
typedef std::false_type is_pointer_aware;
|
||||
typedef std::false_type is_associative;
|
||||
typedef std::false_type is_unordered;
|
||||
typedef std::false_type is_mapped;
|
||||
};
|
||||
|
||||
// Primary template does nothing. Specialize on each type under
|
||||
// test, derive off of traits_base and just add the true traits.
|
||||
template<typename _Tp>
|
||||
struct traits;
|
||||
|
||||
// Specialize for each container.
|
||||
template<typename _Tp, size_t _Np>
|
||||
struct traits<std::array<_Tp, _Np> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_reversible;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::deque<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_reversible;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::forward_list<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::list<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_reversible;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
};
|
||||
|
||||
template<typename _Kp, typename _Tp>
|
||||
struct traits<std::map<_Kp, _Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_reversible;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
typedef std::true_type is_associative;
|
||||
typedef std::true_type is_mapped;
|
||||
};
|
||||
|
||||
template<typename _Kp, typename _Tp>
|
||||
struct traits<std::multimap<_Kp, _Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_reversible;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
typedef std::true_type is_associative;
|
||||
typedef std::true_type is_mapped;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::multiset<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_reversible;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
typedef std::true_type is_associative;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::priority_queue<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_adaptor;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::queue<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_adaptor;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::set<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_reversible;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
typedef std::true_type is_associative;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::stack<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_adaptor;
|
||||
};
|
||||
|
||||
template<typename _Kp, typename _Tp>
|
||||
struct traits<std::unordered_map<_Kp, _Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
typedef std::true_type is_unordered;
|
||||
typedef std::true_type is_mapped;
|
||||
};
|
||||
|
||||
template<typename _Kp, typename _Tp>
|
||||
struct traits<std::unordered_multimap<_Kp, _Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
typedef std::true_type is_unordered;
|
||||
typedef std::true_type is_mapped;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::unordered_multiset<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
typedef std::true_type is_unordered;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::unordered_set<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
typedef std::true_type is_unordered;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::vector<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_reversible;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<std::basic_string<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_reversible;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct traits<__gnu_cxx::__versa_string<_Tp> > : public traits_base
|
||||
{
|
||||
typedef std::true_type is_container;
|
||||
typedef std::true_type is_reversible;
|
||||
typedef std::true_type is_allocator_aware;
|
||||
typedef std::true_type is_pointer_aware;
|
||||
};
|
||||
} // namespace __gnu_test
|
||||
|
||||
#endif
|
238
libstdc++-v3/testsuite/util/testsuite_containers.h
Normal file
238
libstdc++-v3/testsuite/util/testsuite_containers.h
Normal file
|
@ -0,0 +1,238 @@
|
|||
// -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2009 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 3, 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 COPYING3. If not see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef _GLIBCXX_TESTSUITE_CONTAINERS_H
|
||||
#define _GLIBCXX_TESTSUITE_CONTAINERS_H
|
||||
|
||||
#include <cassert>
|
||||
#include <testsuite_container_traits.h>
|
||||
|
||||
// Container requirement testing.
|
||||
namespace __gnu_test
|
||||
{
|
||||
// Compile-time typedef testing.
|
||||
template<typename _Tp, bool _Bt = traits<_Tp>::is_container::value>
|
||||
struct basic_types
|
||||
{
|
||||
// Base container requirements (table 80)
|
||||
typedef _Tp test_type;
|
||||
typedef typename test_type::value_type value_type;
|
||||
typedef typename test_type::reference reference;
|
||||
typedef typename test_type::const_reference const_reference;
|
||||
typedef typename test_type::iterator iterator;
|
||||
typedef typename test_type::const_iterator const_iterator;
|
||||
typedef typename test_type::size_type size_type;
|
||||
typedef typename test_type::difference_type difference_type;
|
||||
};
|
||||
|
||||
// Conditional typedef testing, positive.
|
||||
template<typename _Tp, bool _Bt = traits<_Tp>::is_reversible::value>
|
||||
struct reversible_types
|
||||
{
|
||||
// Reversible container requirements (table 81)
|
||||
typedef _Tp test_type;
|
||||
typedef typename test_type::reverse_iterator reverse_iterator;
|
||||
typedef typename test_type::const_reverse_iterator const_reverse_iterator;
|
||||
};
|
||||
|
||||
template<typename _Tp, bool _Bt = traits<_Tp>::is_allocator_aware::value>
|
||||
struct allocator_aware_types
|
||||
{
|
||||
// Allocator-aware requirements (table 82)
|
||||
typedef _Tp test_type;
|
||||
typedef typename test_type::allocator_type allocator_type;
|
||||
};
|
||||
|
||||
template<typename _Tp, bool _Bt = traits<_Tp>::is_pointer_aware::value>
|
||||
struct pointer_aware_types
|
||||
{
|
||||
// Allocator-aware requirements (table 82)
|
||||
typedef _Tp test_type;
|
||||
typedef typename test_type::pointer pointer;
|
||||
typedef typename test_type::const_pointer const_pointer;
|
||||
};
|
||||
|
||||
template<typename _Tp, bool _Bt = traits<_Tp>::is_associative::value>
|
||||
struct associative_types
|
||||
{
|
||||
// Associative container requirements (table 85)
|
||||
typedef _Tp test_type;
|
||||
typedef typename test_type::key_type key_type;
|
||||
typedef typename test_type::key_compare key_compare;
|
||||
typedef typename test_type::value_compare value_compare;
|
||||
};
|
||||
|
||||
template<typename _Tp, bool = traits<_Tp>::is_unordered::value>
|
||||
struct unordered_types
|
||||
{
|
||||
// Unordered associative container requirements (table 87)
|
||||
typedef _Tp test_type;
|
||||
typedef typename test_type::key_type key_type;
|
||||
typedef typename test_type::hasher hasher;
|
||||
typedef typename test_type::key_equal key_equal;
|
||||
typedef typename test_type::local_iterator local_iterator;
|
||||
typedef typename test_type::const_local_iterator const_local_iterator;
|
||||
};
|
||||
|
||||
template<typename _Tp, bool _Bt = traits<_Tp>::is_mapped::value>
|
||||
struct mapped_types
|
||||
{
|
||||
typedef _Tp test_type;
|
||||
typedef typename test_type::mapped_type mapped_type;
|
||||
};
|
||||
|
||||
template<typename _Tp, bool = traits<_Tp>::is_adaptor::value>
|
||||
struct adaptor_types
|
||||
{
|
||||
// Container adaptor requirements.
|
||||
typedef _Tp test_type;
|
||||
typedef typename test_type::value_type value_type;
|
||||
typedef typename test_type::reference reference;
|
||||
typedef typename test_type::const_reference const_reference;
|
||||
typedef typename test_type::size_type size_type;
|
||||
typedef typename test_type::container_type container_type;
|
||||
};
|
||||
|
||||
// Conditional typedef testing, negative.
|
||||
template<typename _Tp>
|
||||
struct basic_types<_Tp, false> { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct reversible_types<_Tp, false> { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct allocator_aware_types<_Tp, false> { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct pointer_aware_types<_Tp, false> { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct associative_types<_Tp, false> { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct unordered_types<_Tp, false> { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct mapped_types<_Tp, false> { };
|
||||
|
||||
template<typename _Tp>
|
||||
struct adaptor_types<_Tp, false> { };
|
||||
|
||||
// Primary template.
|
||||
template<typename _Tp>
|
||||
struct types
|
||||
: basic_types<_Tp>, adaptor_types<_Tp>, reversible_types<_Tp>,
|
||||
allocator_aware_types<_Tp>, pointer_aware_types<_Tp>,
|
||||
associative_types<_Tp>, unordered_types<_Tp>, mapped_types<_Tp>
|
||||
{ };
|
||||
|
||||
|
||||
// Run-time test for constant_iterator requirements.
|
||||
template<typename _Tp, bool = traits<_Tp>::is_allocator_aware::value>
|
||||
struct populate
|
||||
{
|
||||
populate(_Tp& container)
|
||||
{
|
||||
typename _Tp::value_type v;
|
||||
container.insert(container.begin(), v);
|
||||
container.insert(container.begin(), v);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct populate<_Tp, false>
|
||||
{
|
||||
populate(_Tp& container) { }
|
||||
};
|
||||
|
||||
template<typename _Tp, bool = traits<_Tp>::is_reversible::value>
|
||||
struct reverse_members
|
||||
{
|
||||
reverse_members(_Tp& container)
|
||||
{
|
||||
assert( container.crbegin() == container.rbegin() );
|
||||
assert( container.crend() == container.rend() );
|
||||
assert( container.crbegin() != container.crend() );
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct reverse_members<_Tp, false>
|
||||
{
|
||||
reverse_members(_Tp& container) { }
|
||||
};
|
||||
|
||||
// DR 691.
|
||||
template<typename _Tp, bool = traits<_Tp>::is_unordered::value>
|
||||
struct forward_members_unordered
|
||||
{
|
||||
forward_members_unordered(typename _Tp::value_type& v)
|
||||
{
|
||||
typedef _Tp test_type;
|
||||
test_type container;
|
||||
container.insert(v);
|
||||
assert( container.cbegin(0) == container.begin(0) );
|
||||
assert( container.cend(0) == container.end(0) );
|
||||
const typename test_type::size_type bn = container.bucket(1);
|
||||
assert( container.cbegin(bn) != container.cend(bn) );
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct forward_members_unordered<_Tp, false>
|
||||
{
|
||||
forward_members_unordered(_Tp& container) { }
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
struct citerator
|
||||
{
|
||||
typedef _Tp test_type;
|
||||
typedef traits<test_type> traits_type;
|
||||
typedef typename test_type::value_type value_type;
|
||||
|
||||
static test_type _S_container;
|
||||
|
||||
// Unconditional.
|
||||
struct forward_members
|
||||
{
|
||||
forward_members()
|
||||
{
|
||||
assert( _S_container.cbegin() == _S_container.begin() );
|
||||
assert( _S_container.cend() == _S_container.end() );
|
||||
assert( _S_container.cbegin() != _S_container.cend() );
|
||||
}
|
||||
};
|
||||
|
||||
// Run test.
|
||||
citerator()
|
||||
{
|
||||
populate<test_type> p(_S_container);
|
||||
forward_members m1;
|
||||
reverse_members<test_type> m2(_S_container);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename _Tp>
|
||||
_Tp citerator<_Tp>::_S_container;
|
||||
|
||||
|
||||
} // namespace __gnu_test
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue