summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-20 04:05:21 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-20 04:05:21 +0000
commit2b48700aa2898a4510cdf8423489b75c365cf6b0 (patch)
treedc0ad6d2d060b0ec8282bd5937aebdc5b82254b4
parentfffbaaf2c48cd01c8fa93e3ad84e1bec1120f06f (diff)
downloadgcc-2b48700aa2898a4510cdf8423489b75c365cf6b0.tar.gz
2009-05-19 Benjamin Kosnik <bkoz@redhat.com>
* testsuite/23_containers/list/14340.cc: Abstract list type. * testsuite/23_containers/list/init-list.cc: Same. * testsuite/23_containers/list/pthread5.cc: Same. * testsuite/23_containers/list/invalidation/1.cc: Same. * testsuite/23_containers/list/invalidation/2.cc: Same. * testsuite/23_containers/list/invalidation/3.cc: Same. * testsuite/23_containers/list/invalidation/4.cc: Same. * testsuite/23_containers/list/modifiers/insert/25288.cc: Same. * testsuite/23_containers/list/modifiers/1.cc: Same. * testsuite/23_containers/list/modifiers/2.cc: Same. * testsuite/23_containers/list/modifiers/3.cc: Same. * testsuite/23_containers/list/modifiers/swap/1.cc: Same. * testsuite/23_containers/list/modifiers/swap/2.cc: Same. * testsuite/23_containers/list/modifiers/swap/3.cc: Same. * testsuite/23_containers/list/cons/1.cc: Same. * testsuite/23_containers/list/cons/2.cc: Same. * testsuite/23_containers/list/cons/3.cc: Same. * testsuite/23_containers/list/cons/4.cc: Same. * testsuite/23_containers/list/cons/5.cc: Same. * testsuite/23_containers/list/cons/6.cc: Same. * testsuite/23_containers/list/cons/7.cc: Same. * testsuite/23_containers/list/cons/clear_allocator.cc: Same. * testsuite/23_containers/list/cons/8.cc: Same. * testsuite/23_containers/list/cons/9.cc: Same. * testsuite/23_containers/list/operations/1.cc: Same. * testsuite/23_containers/list/operations/2.cc: Same. * testsuite/23_containers/list/operations/3.cc: Same. * testsuite/23_containers/list/operations/4.cc: Same. * testsuite/23_containers/list/operations/5.cc: Same. * testsuite/23_containers/list/requirements/citerators.cc: Same. * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same. * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same. * testsuite/23_containers/list/requirements/dr438/ constructor_1_neg.cc: Same. * testsuite/23_containers/list/requirements/dr438/ constructor_2_neg.cc: Same. * testsuite/23_containers/list/requirements/dr438/constructor.cc: Same. * testsuite/23_containers/list/requirements/ partial_specialization/1.cc: Same. * testsuite/23_containers/list/23781.cc: Same. * testsuite/23_containers/list/pthread1.cc: Same. * testsuite/23_containers/list/capacity/1.cc: Same. * testsuite/23_containers/list/capacity/29134.cc: Same. * testsuite/23_containers/list/check_construct_destroy.cc: Same. * testsuite/23_containers/list/moveable.cc: Same. * testsuite/util/common_type/assoc/common_type.hpp: Re-break lines. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147728 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog50
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/14340.cc4
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/23781.cc5
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/capacity/1.cc17
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc29
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/1.cc43
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/2.cc44
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/3.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/4.cc20
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/5.cc17
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/6.cc15
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/7.cc15
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/8.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/9.cc19
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/init-list.cc34
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/invalidation/1.cc18
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/invalidation/2.cc21
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/invalidation/3.cc20
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/invalidation/4.cc21
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc72
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc63
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc61
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc24
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc26
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc46
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc46
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/moveable.cc32
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/1.cc19
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/2.cc21
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/3.cc27
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/4.cc24
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/operations/5.cc23
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/pthread1.cc19
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/pthread5.cc13
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc4
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc3
-rw-r--r--libstdc++-v3/testsuite/23_containers/list/requirements/partial_specialization/1.cc2
-rw-r--r--libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp14
44 files changed, 572 insertions, 429 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 03a1397f624..80460d3a8d0 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,53 @@
+2009-05-19 Benjamin Kosnik <bkoz@redhat.com>
+
+ * testsuite/23_containers/list/14340.cc: Abstract list type.
+ * testsuite/23_containers/list/init-list.cc: Same.
+ * testsuite/23_containers/list/pthread5.cc: Same.
+ * testsuite/23_containers/list/invalidation/1.cc: Same.
+ * testsuite/23_containers/list/invalidation/2.cc: Same.
+ * testsuite/23_containers/list/invalidation/3.cc: Same.
+ * testsuite/23_containers/list/invalidation/4.cc: Same.
+ * testsuite/23_containers/list/modifiers/insert/25288.cc: Same.
+ * testsuite/23_containers/list/modifiers/1.cc: Same.
+ * testsuite/23_containers/list/modifiers/2.cc: Same.
+ * testsuite/23_containers/list/modifiers/3.cc: Same.
+ * testsuite/23_containers/list/modifiers/swap/1.cc: Same.
+ * testsuite/23_containers/list/modifiers/swap/2.cc: Same.
+ * testsuite/23_containers/list/modifiers/swap/3.cc: Same.
+ * testsuite/23_containers/list/cons/1.cc: Same.
+ * testsuite/23_containers/list/cons/2.cc: Same.
+ * testsuite/23_containers/list/cons/3.cc: Same.
+ * testsuite/23_containers/list/cons/4.cc: Same.
+ * testsuite/23_containers/list/cons/5.cc: Same.
+ * testsuite/23_containers/list/cons/6.cc: Same.
+ * testsuite/23_containers/list/cons/7.cc: Same.
+ * testsuite/23_containers/list/cons/clear_allocator.cc: Same.
+ * testsuite/23_containers/list/cons/8.cc: Same.
+ * testsuite/23_containers/list/cons/9.cc: Same.
+ * testsuite/23_containers/list/operations/1.cc: Same.
+ * testsuite/23_containers/list/operations/2.cc: Same.
+ * testsuite/23_containers/list/operations/3.cc: Same.
+ * testsuite/23_containers/list/operations/4.cc: Same.
+ * testsuite/23_containers/list/operations/5.cc: Same.
+ * testsuite/23_containers/list/requirements/citerators.cc: Same.
+ * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: Same.
+ * testsuite/23_containers/list/requirements/dr438/insert_neg.cc: Same.
+ * testsuite/23_containers/list/requirements/dr438/
+ constructor_1_neg.cc: Same.
+ * testsuite/23_containers/list/requirements/dr438/
+ constructor_2_neg.cc: Same.
+ * testsuite/23_containers/list/requirements/dr438/constructor.cc: Same.
+ * testsuite/23_containers/list/requirements/
+ partial_specialization/1.cc: Same.
+ * testsuite/23_containers/list/23781.cc: Same.
+ * testsuite/23_containers/list/pthread1.cc: Same.
+ * testsuite/23_containers/list/capacity/1.cc: Same.
+ * testsuite/23_containers/list/capacity/29134.cc: Same.
+ * testsuite/23_containers/list/check_construct_destroy.cc: Same.
+ * testsuite/23_containers/list/moveable.cc: Same.
+
+ * testsuite/util/common_type/assoc/common_type.hpp: Re-break lines.
+
2009-05-19 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/40184
diff --git a/libstdc++-v3/testsuite/23_containers/list/14340.cc b/libstdc++-v3/testsuite/23_containers/list/14340.cc
index 2d2d683786c..26b5df6d059 100644
--- a/libstdc++-v3/testsuite/23_containers/list/14340.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/14340.cc
@@ -27,7 +27,7 @@
// libstdc++/14340
int main()
{
- typedef std::list<int> container;
- __gnu_test::conversion<container>::iterator_to_const_iterator();
+ typedef std::list<int> list_type;
+ __gnu_test::conversion<list_type>::iterator_to_const_iterator();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/23781.cc b/libstdc++-v3/testsuite/23_containers/list/23781.cc
index 4dded91769c..ca275bda5ad 100644
--- a/libstdc++-v3/testsuite/23_containers/list/23781.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/23781.cc
@@ -23,5 +23,6 @@
// libstdc++/23781
#include <list>
-std::list<int>::iterator it = NULL; // { dg-error "conversion" }
-std::list<int>::const_iterator cit = NULL; // { dg-error "conversion" }
+typedef std::list<int> list_type;
+list_type::iterator it = NULL; // { dg-error "conversion" }
+list_type::const_iterator cit = NULL; // { dg-error "conversion" }
diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc b/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc
index a8f4249769d..d820776e3a8 100644
--- a/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/capacity/1.cc
@@ -20,8 +20,6 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// This test verifies the following.
//
// 23.2.2 bool empty() const
@@ -32,10 +30,15 @@ bool test __attribute__((unused)) = true;
// 23.2.2 size_type max_size() const
// 23.2.2.2 void resize(size_type s, T c = T())
//
+template<typename _Tp>
void
-test01()
+capacity01()
{
- std::list<int> list0101;
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator_type;
+
+ list_type list0101;
VERIFY(list0101.empty());
VERIFY(list0101.size() == 0);
@@ -47,7 +50,7 @@ test01()
VERIFY(!list0101.empty());
VERIFY(list0101.size() == 3);
- std::list<int>::iterator i = list0101.begin();
+ iterator_type i = list0101.begin();
VERIFY(*i == 1); ++i;
VERIFY(*i == 2); ++i;
VERIFY(*i == 2); ++i;
@@ -61,8 +64,6 @@ test01()
int
main()
{
- test01();
+ capacity01<std::list<int> >();
return 0;
}
-
-// vi:set sw=2 ts=2:
diff --git a/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc b/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc
index 717c3eae070..48394079750 100644
--- a/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/capacity/29134.cc
@@ -25,7 +25,8 @@ void test01()
{
bool test __attribute__((unused)) = true;
- std::list<int> l;
+ typedef std::list<int> list_type;
+ list_type l;
#ifndef _GLIBCXX_DEBUG
using std::_List_node;
diff --git a/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc b/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc
index f6e19907c2e..a223bc85007 100644
--- a/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/check_construct_destroy.cc
@@ -22,17 +22,21 @@
#include <iterator>
#include <testsuite_allocator.h>
-using namespace __gnu_test;
-int main()
+template<typename _Tp>
+bool
+construct_destroy()
{
- typedef std::list<int, tracker_allocator<int> > Container;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator_type;
+
+ using namespace __gnu_test;
const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
bool ok = true;
tracker_allocator_counter::reset();
{
- Container c;
+ list_type c;
ok = check_construct_destroy("empty container", 0, 0) && ok;
}
ok = check_construct_destroy("empty container", 0, 0) && ok;
@@ -40,13 +44,13 @@ int main()
tracker_allocator_counter::reset();
{
- Container c(arr10, arr10 + 10);
+ list_type c(arr10, arr10 + 10);
ok = check_construct_destroy("Construct from range", 10, 0) && ok;
}
ok = check_construct_destroy("Construct from range", 10, 10) && ok;
{
- Container c(arr10, arr10 + 10);
+ list_type c(arr10, arr10 + 10);
tracker_allocator_counter::reset();
c.insert(c.begin(), arr10[0]);
ok = check_construct_destroy("Insert element", 1, 0) && ok;
@@ -54,9 +58,9 @@ int main()
ok = check_construct_destroy("Insert element", 1, 11) && ok;
{
- Container c(arr10, arr10 + 10);
+ list_type c(arr10, arr10 + 10);
tracker_allocator_counter::reset();
- Container::iterator i5 = c.begin();
+ iterator_type i5 = c.begin();
std::advance(i5, 5);
c.insert(i5, arr10, arr10+3);
ok = check_construct_destroy("Insert short range", 3, 0) && ok;
@@ -64,9 +68,9 @@ int main()
ok = check_construct_destroy("Insert short range", 3, 13) && ok;
{
- Container c(arr10, arr10 + 10);
+ list_type c(arr10, arr10 + 10);
tracker_allocator_counter::reset();
- Container::iterator i7 = c.begin();
+ iterator_type i7 = c.begin();
std::advance(i7, 5);
c.insert(i7, arr10, arr10+10);
ok = check_construct_destroy("Insert long range", 10, 0) && ok;
@@ -76,3 +80,8 @@ int main()
return ok ? 0 : 1;
}
+int main()
+{
+ construct_destroy<std::list<int, __gnu_test::tracker_allocator<int> > >();
+ return 0;
+}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/1.cc b/libstdc++-v3/testsuite/23_containers/list/cons/1.cc
index 343767637c1..2228a506fe9 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/1.cc
@@ -20,8 +20,6 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// A nontrivial type.
template<typename T>
struct A { };
@@ -29,13 +27,6 @@ template<typename T>
// 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_;
-};
-
// Default constructor, basic properties
//
// This test verifies the following.
@@ -46,32 +37,36 @@ struct C {
// 23.2.2 size_type size() const
// 23.2.2 existence of required typedefs
//
+template<typename _Tp>
void
-test01()
+cons01()
{
- std::list< A<B> > list0101;
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
+ list_type list0101;
VERIFY(list0101.begin() == list0101.end());
VERIFY(list0101.size() == 0);
// check type definitions -- will fail compile if missing
- typedef std::list< A<B> >::reference reference;
- typedef std::list< A<B> >::const_reference const_reference;
- typedef std::list< A<B> >::iterator iterator;
- typedef std::list< A<B> >::const_iterator const_iterator;
- typedef std::list< A<B> >::size_type size_type;
- typedef std::list< A<B> >::difference_type difference_type;
- typedef std::list< A<B> >::value_type value_type;
- typedef std::list< A<B> >::allocator_type allocator_type;
- typedef std::list< A<B> >::pointer pointer;
- typedef std::list< A<B> >::const_pointer const_pointer;
- typedef std::list< A<B> >::reverse_iterator reverse_iterator;
- typedef std::list< A<B> >::const_reverse_iterator const_reverse_iterator;
+ typedef typename list_type::reference reference;
+ typedef typename list_type::const_reference const_reference;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::const_iterator const_iterator;
+ typedef typename list_type::size_type size_type;
+ typedef typename list_type::difference_type difference_type;
+ typedef typename list_type::value_type value_type;
+ typedef typename list_type::allocator_type allocator_type;
+ typedef typename list_type::pointer pointer;
+ typedef typename list_type::const_pointer const_pointer;
+ typedef typename list_type::reverse_iterator reverse_iterator;
+ typedef typename list_type::const_reverse_iterator const_reverse_iterator;
// allocator checks?
}
int main()
{
- test01();
+ cons01<std::list< A<B> > >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/2.cc b/libstdc++-v3/testsuite/23_containers/list/cons/2.cc
index ee6864e0333..a38cf7d1bba 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/2.cc
@@ -20,8 +20,6 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// A nontrivial type.
template<typename T>
struct A { };
@@ -29,34 +27,29 @@ template<typename T>
// 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_;
-};
-
// Fill constructor
//
// This test verifies the following.
-// 23.2.2.1 explicit list(size_type n, const T& v = T(), const a& = Allocator())
-// 23.2.2 const_iterator begin() const
-// 23.2.2 const_iterator end() const
-// 23.2.2 size_type size() const
+// 23.2.2.1 explicit list(size_type n, const T& v = T(), const a& = Allocator())
+// 23.2.2 const_iterator begin() const
+// 23.2.2 const_iterator end() const
+// 23.2.2 size_type size() const
//
+template<typename _Tp>
void
-test02()
+cons021()
{
+ bool test __attribute__((unused)) = true;
const std::size_t LIST_SIZE = 5;
const int INIT_VALUE = 7;
std::size_t count;
- std::list<int>::const_iterator i;
- // nontrivial value_type
- std::list< A<B> > list0201(LIST_SIZE);
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
// default value
- std::list<int> list0202(LIST_SIZE);
+ list_type list0202(LIST_SIZE);
for (i = list0202.begin(), count = 0;
i != list0202.end();
++i, ++count)
@@ -65,7 +58,7 @@ test02()
VERIFY(list0202.size() == LIST_SIZE);
// explicit value
- std::list<int> list0203(LIST_SIZE, INIT_VALUE);
+ list_type list0203(LIST_SIZE, INIT_VALUE);
for (i = list0203.begin(), count = 0;
i != list0203.end();
++i, ++count)
@@ -74,8 +67,19 @@ test02()
VERIFY(list0203.size() == LIST_SIZE);
}
+template<typename _Tp>
+void
+cons022()
+{
+ // nontrivial value_type
+ typedef _Tp list_type;
+ const std::size_t LIST_SIZE = 5;
+ list_type list0201(LIST_SIZE);
+}
+
int main()
{
- test02();
+ cons021<std::list<int> >();
+ cons022<std::list< A<B> > >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/3.cc b/libstdc++-v3/testsuite/23_containers/list/cons/3.cc
index c9b1fe887b0..b067ee17bc2 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/3.cc
@@ -20,31 +20,28 @@
#include <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 {
+struct C
+{
C(int i) : i_(i) { }
bool operator==(const C& rhs) { return i_ == rhs.i_; }
int i_;
};
// Fill constructor disguised as a range constructor
+template<typename _Tp>
void
-test02D()
+cons03()
{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
const std::size_t LIST_SIZE = 5;
const int INIT_VALUE = 7;
std::size_t count = 0;
- std::list<C> list0204(LIST_SIZE, INIT_VALUE);
- std::list<C>::iterator i = list0204.begin();
+ list_type list0204(LIST_SIZE, INIT_VALUE);
+ iterator i = list0204.begin();
for (; i != list0204.end(); ++i, ++count)
VERIFY(*i == INIT_VALUE);
VERIFY(count == LIST_SIZE);
@@ -53,7 +50,6 @@ test02D()
int main()
{
- test02D();
+ cons03<std::list<C> >();
return 0;
}
-// vi:set sw=2 ts=2:
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/4.cc b/libstdc++-v3/testsuite/23_containers/list/cons/4.cc
index 83b674f43c0..0dde9e9eaf4 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/4.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/4.cc
@@ -20,26 +20,30 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// Range constructor
//
// This test verifies the following.
-// 23.2.2.1 template list(InputIterator f, InputIterator l, const Allocator& a = Allocator())
+// 23.2.2.1 template list(InputIterator f, InputIterator l,
+// const Allocator& a = Allocator())
// 23.2.2 const_iterator begin() const
// 23.2.2 const_iterator end() const
// 23.2.2 size_type size() const
//
+template<typename _Tp>
void
-test03()
+cons04()
{
+ bool test __attribute__((unused)) = true;
const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
const std::size_t N = sizeof(A) / sizeof(int);
std::size_t count;
- std::list<int>::const_iterator i;
+
+ typedef std::list<int> list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
// construct from a dissimilar range
- std::list<int> list0301(A, A + N);
+ list_type list0301(A, A + N);
for (i = list0301.begin(), count = 0;
i != list0301.end();
++i, ++count)
@@ -48,7 +52,7 @@ test03()
VERIFY(list0301.size() == N);
// construct from a similar range
- std::list<int> list0302(list0301.begin(), list0301.end());
+ list_type list0302(list0301.begin(), list0301.end());
for (i = list0302.begin(), count = 0;
i != list0302.end();
++i, ++count)
@@ -59,7 +63,7 @@ test03()
int main()
{
- test03();
+ cons04<std::list<int> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/5.cc b/libstdc++-v3/testsuite/23_containers/list/cons/5.cc
index 38498788b13..be8b5921aeb 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/5.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/5.cc
@@ -20,8 +20,6 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// Copy constructor
//
// This test verifies the following.
@@ -30,16 +28,21 @@ bool test __attribute__((unused)) = true;
// 23.2.2 reverse_iterator rend()
// 23.2.2 size_type size() const
//
+template<typename _Tp>
void
-test04()
+cons05()
{
+ bool test __attribute__((unused)) = true;
const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
const std::size_t N = sizeof(A) / sizeof(int);
int count;
- std::list<int>::reverse_iterator i;
- std::list<int> list0401(A, A + N);
- std::list<int> list0402(list0401);
+ typedef _Tp list_type;
+ typedef typename list_type::reverse_iterator reverse_iterator;
+ reverse_iterator i;
+ list_type list0401(A, A + N);
+
+ list_type list0402(list0401);
for (i = list0401.rbegin(), count = N - 1;
i != list0401.rend();
++i, --count)
@@ -50,7 +53,7 @@ test04()
int main()
{
- test04();
+ cons05<std::list<int> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/6.cc b/libstdc++-v3/testsuite/23_containers/list/cons/6.cc
index 1355629f32a..e0d62817e5b 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/6.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/6.cc
@@ -20,8 +20,6 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// Range assign
//
// This test verifies the following.
@@ -30,17 +28,22 @@ bool test __attribute__((unused)) = true;
// 23.2.2 const_iterator end() const
// 23.2.2 size_type size() const
//
+template<typename _Tp>
void
-test05()
+cons05()
{
+ bool test __attribute__((unused)) = true;
const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};
const int B[] = {101, 102, 103, 104, 105};
const std::size_t N = sizeof(A) / sizeof(int);
const std::size_t M = sizeof(B) / sizeof(int);
std::size_t count;
- std::list<int>::const_iterator i;
- std::list<int> list0501;
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
+
+ list_type list0501;
// make it bigger
list0501.assign(A, A + N);
@@ -63,7 +66,7 @@ test05()
int main()
{
- test05();
+ cons05<std::list<int> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/7.cc b/libstdc++-v3/testsuite/23_containers/list/cons/7.cc
index 6f396edc650..9a626a6234f 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/7.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/7.cc
@@ -20,8 +20,6 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// Fill assign
//
// This test verifies the following.
@@ -30,17 +28,22 @@ bool test __attribute__((unused)) = true;
// 23.2.2 const_iterator end() const
// 23.2.2 size_type size() const
//
+template<typename _Tp>
void
-test06()
+cons07()
{
+ bool test __attribute__((unused)) = true;
const std::size_t BIG_LIST_SIZE = 11;
const int BIG_INIT_VALUE = 7;
const std::size_t SMALL_LIST_SIZE = 5;
const int SMALL_INIT_VALUE = 17;
std::size_t count;
- std::list<int>::const_iterator i;
- std::list<int> list0601;
+ typedef _Tp list_type;
+ typedef typename list_type::const_iterator const_iterator;
+ const_iterator i;
+
+ list_type list0601;
VERIFY(list0601.size() == 0);
// make it bigger
@@ -64,7 +67,7 @@ test06()
int main()
{
- test06();
+ cons07<std::list<int> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/8.cc b/libstdc++-v3/testsuite/23_containers/list/cons/8.cc
index d20a8a71cd3..f93520c5406 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/8.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/8.cc
@@ -20,35 +20,31 @@
#include <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 {
+struct C
+{
C(int i) : i_(i) { }
bool operator==(const C& rhs) { return i_ == rhs.i_; }
int i_;
};
// Fill Assignment disguised as a Range Assignment
+template<typename _Tp>
void
-test06D()
+cons08()
{
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+ bool test __attribute__((unused)) = true;
const std::size_t LIST_SIZE = 5;
const int INIT_VALUE = 7;
std::size_t count = 0;
- std::list<C> list0604;
+
+ list_type list0604;
VERIFY(list0604.size() == 0);
list0604.assign(LIST_SIZE, INIT_VALUE);
- std::list<C>::iterator i = list0604.begin();
+ iterator i = list0604.begin();
for (; i != list0604.end(); ++i, ++count)
VERIFY(*i == INIT_VALUE);
VERIFY(count == LIST_SIZE);
@@ -57,7 +53,7 @@ test06D()
int main()
{
- test06D();
+ cons08<std::list<C> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/9.cc b/libstdc++-v3/testsuite/23_containers/list/cons/9.cc
index c25da98a785..87cb0270c40 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/9.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/9.cc
@@ -20,8 +20,6 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// Assignment operator
//
// This test verifies the following.
@@ -31,18 +29,24 @@ bool test __attribute__((unused)) = true;
// 23.2.2 size_type size() const
// 23.2.2 bool operator==(const list& x, const list& y)
//
+template<typename _Tp>
void
-test07()
+cons09()
{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
const int A[] = {701, 702, 703, 704, 705};
const std::size_t N = sizeof(A) / sizeof(int);
std::size_t count;
- std::list<int>::iterator i;
- std::list<int> list0701(A, A + N);
+ iterator i;
+
+ list_type list0701(A, A + N);
VERIFY(list0701.size() == N);
- std::list<int> list0702;
+ list_type list0702;
VERIFY(list0702.size() == 0);
list0702 = list0701;
@@ -57,7 +61,6 @@ test07()
int main()
{
- test07();
+ cons09<std::list<int> >();
return 0;
}
-// vi:set sw=2 ts=2:
diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc b/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc
index 6a52bb70f1b..82a47ade754 100644
--- a/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/cons/clear_allocator.cc
@@ -81,7 +81,8 @@ template<typename Container>
int main()
{
- Check_Container<std::list<int, clear_alloc<int> > >();
+ typedef std::list<int, clear_alloc<int> > list_type;
+ Check_Container<list_type>();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/init-list.cc b/libstdc++-v3/testsuite/23_containers/list/init-list.cc
index b611067ba11..261ef084f09 100644
--- a/libstdc++-v3/testsuite/23_containers/list/init-list.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/init-list.cc
@@ -21,28 +21,31 @@
#include <list>
#include <testsuite_allocator.h>
-using namespace __gnu_test;
-
-int main()
+template<typename _Tp>
+bool
+init_list()
{
- typedef std::list<int, tracker_allocator<int> > Container;
+ using namespace __gnu_test;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
const int arr10[10] = { 2, 4, 1, 7, 3, 8, 10, 5, 9, 6 };
bool ok = true;
tracker_allocator_counter::reset();
{
- Container c({ 2, 4, 1 });
+ list_type c({ 2, 4, 1 });
ok = check_construct_destroy("Construct from init-list", 3, 0) && ok;
- Container::iterator i = c.begin();
+ iterator i = c.begin();
ok &= (*i++ == 2);
ok &= (*i++ == 4);
}
ok = check_construct_destroy("Construct from init-list", 3, 3) && ok;
{
- Container c(arr10, arr10 + 10);
+ list_type c(arr10, arr10 + 10);
tracker_allocator_counter::reset();
- Container::iterator i = c.begin();
+ iterator i = c.begin();
++i; ++i; ++i; ++i; ++i; ++i; ++i;
c.insert(i, { 234, 42, 1 });
ok = check_construct_destroy("Insert init-list", 3, 0) && ok;
@@ -52,14 +55,23 @@ int main()
ok = check_construct_destroy("Insert init-list", 3, 13) && ok;
{
- Container c;
+ list_type c;
tracker_allocator_counter::reset();
c = { 13, 0, 42 };
ok = check_construct_destroy("Assign init-list", 3, 0) && ok;
- Container::iterator i = c.begin();
+ iterator i = c.begin();
ok &= (*i++ == 13);
}
ok = check_construct_destroy("Assign init-list", 3, 3) && ok;
- return ok ? 0 : 1;;
+ return ok ? 0 : 1;
+}
+
+int main()
+{
+ typedef int value_type;
+ typedef __gnu_test::tracker_allocator<int> allocator_type;
+ typedef std::list<value_type, allocator_type> list_type;
+ init_list<list_type>();
+ return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/invalidation/1.cc b/libstdc++-v3/testsuite/23_containers/list/invalidation/1.cc
index 61cc3f2873a..04267c253c7 100644
--- a/libstdc++-v3/testsuite/23_containers/list/invalidation/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/invalidation/1.cc
@@ -21,21 +21,21 @@
#include <iterator>
#include <testsuite_hooks.h>
-using __gnu_debug::list;
-using std::advance;
-
-bool test = true;
-
// Assignment
void test01()
{
- list<int> v1;
- list<int> v2;
+ using std::advance;
+
+ bool test = true;
+
+ typedef __gnu_debug::list<int> list_type;
+ list_type v1;
+ list_type v2;
v1.push_front(17);
- list<int>::iterator start = v1.begin();
- list<int>::iterator finish = v1.end();
+ list_type::iterator start = v1.begin();
+ list_type::iterator finish = v1.end();
VERIFY(start._M_dereferenceable());
VERIFY(!finish._M_dereferenceable() && !finish._M_singular());
diff --git a/libstdc++-v3/testsuite/23_containers/list/invalidation/2.cc b/libstdc++-v3/testsuite/23_containers/list/invalidation/2.cc
index c841be3df68..a141f2cdc82 100644
--- a/libstdc++-v3/testsuite/23_containers/list/invalidation/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/invalidation/2.cc
@@ -21,23 +21,24 @@
#include <iterator>
#include <testsuite_hooks.h>
-using __gnu_debug::list;
-using std::advance;
-
-bool test = true;
-
// Resize
void test02()
{
- list<int> v(10, 17);
+ using std::advance;
+
+ bool test = true;
+
+ typedef __gnu_debug::list<int> list_type;
+
+ list_type v(10, 17);
- list<int>::iterator before = v.begin();
+ list_type::iterator before = v.begin();
advance(before, 6);
- list<int>::iterator at = before;
+ list_type::iterator at = before;
advance(at, 1);
- list<int>::iterator after = at;
+ list_type::iterator after = at;
advance(after, 1);
- list<int>::iterator finish = v.end();
+ list_type::iterator finish = v.end();
// Shrink
v.resize(7);
diff --git a/libstdc++-v3/testsuite/23_containers/list/invalidation/3.cc b/libstdc++-v3/testsuite/23_containers/list/invalidation/3.cc
index 243dfeb67b5..770d4597484 100644
--- a/libstdc++-v3/testsuite/23_containers/list/invalidation/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/invalidation/3.cc
@@ -21,21 +21,21 @@
#include <iterator>
#include <testsuite_hooks.h>
-using __gnu_debug::list;
-using std::advance;
-
-bool test = true;
-
// Erase
void test03()
{
- list<int> v(20, 42);
+ using std::advance;
+
+ bool test = true;
+ typedef __gnu_debug::list<int> list_type;
+
+ list_type v(20, 42);
// Single element erase (middle)
- list<int>::iterator before = v.begin();
- list<int>::iterator at = before;
+ list_type::iterator before = v.begin();
+ list_type::iterator at = before;
advance(at, 3);
- list<int>::iterator after = at;
+ list_type::iterator after = at;
at = v.erase(at);
VERIFY(before._M_dereferenceable());
VERIFY(at._M_dereferenceable());
@@ -63,7 +63,7 @@ void test03()
// clear()
before = v.begin();
- list<int>::iterator finish = v.end();
+ list_type::iterator finish = v.end();
VERIFY(before._M_dereferenceable());
v.clear();
VERIFY(before._M_singular());
diff --git a/libstdc++-v3/testsuite/23_containers/list/invalidation/4.cc b/libstdc++-v3/testsuite/23_containers/list/invalidation/4.cc
index d8a86ca9639..11e4394fa7d 100644
--- a/libstdc++-v3/testsuite/23_containers/list/invalidation/4.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/invalidation/4.cc
@@ -21,21 +21,22 @@
#include <iterator>
#include <testsuite_hooks.h>
-using __gnu_debug::list;
-using std::advance;
-
-bool test = true;
-
// Splice
void test04()
{
- list<int> l1(10, 17);
- list<int> l2(10, 42);
+ using std::advance;
+
+ bool test = true;
+
+ typedef __gnu_debug::list<int> list_type;
+
+ list_type l1(10, 17);
+ list_type l2(10, 42);
- list<int>::iterator start2 = l2.begin();
- list<int>::iterator end2 = start2;
+ list_type::iterator start2 = l2.begin();
+ list_type::iterator end2 = start2;
advance(end2, 5);
- list<int>::iterator after2 = end2;
+ list_type::iterator after2 = end2;
advance(after2, 2);
l1.splice(l1.begin(), l2, start2, end2);
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc
index d250db8c907..b1c85f0511c 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.cc
@@ -20,99 +20,101 @@
#include <list>
#include <testsuite_hooks.h>
-typedef __gnu_test::copy_tracker T;
-
-bool test __attribute__((unused)) = true;
-
// range and fill insert/erase + clear
// missing: o fill insert disguised as a range insert in all its variants
// o exception effects
+template<typename _Tp>
void
-test03()
+modifiers1()
{
- std::list<T> list0301;
- T::reset();
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::value_type value_type;
+
+ list_type list0301;
+ value_type::reset();
// fill insert at beginning of list / empty list
- list0301.insert(list0301.begin(), 3, T(11)); // should be [11 11 11]
+ list0301.insert(list0301.begin(), 3, value_type(11)); // should be [11 11 11]
VERIFY(list0301.size() == 3);
- VERIFY(T::copyCount() == 3);
+ VERIFY(value_type::copyCount() == 3);
// save iterators to verify post-insert validity
- std::list<T>::iterator b = list0301.begin();
- std::list<T>::iterator m = list0301.end(); --m;
- std::list<T>::iterator e = list0301.end();
+ iterator b = list0301.begin();
+ iterator m = list0301.end(); --m;
+ iterator e = list0301.end();
// fill insert at end of list
- T::reset();
- list0301.insert(list0301.end(), 3, T(13)); // should be [11 11 11 13 13 13]
+ value_type::reset();
+ list0301.insert(list0301.end(), 3, value_type(13)); // should be [11 11 11 13 13 13]
VERIFY(list0301.size() == 6);
- VERIFY(T::copyCount() == 3);
+ VERIFY(value_type::copyCount() == 3);
VERIFY(b == list0301.begin() && b->id() == 11);
VERIFY(e == list0301.end());
VERIFY(m->id() == 11);
// fill insert in the middle of list
++m;
- T::reset();
- list0301.insert(m, 3, T(12)); // should be [11 11 11 12 12 12 13 13 13]
+ value_type::reset();
+ list0301.insert(m, 3, value_type(12)); // should be [11 11 11 12 12 12 13 13 13]
VERIFY(list0301.size() == 9);
- VERIFY(T::copyCount() == 3);
+ VERIFY(value_type::copyCount() == 3);
VERIFY(b == list0301.begin() && b->id() == 11);
VERIFY(e == list0301.end());
VERIFY(m->id() == 13);
// single erase
- T::reset();
+ value_type::reset();
m = list0301.erase(m); // should be [11 11 11 12 12 12 13 13]
VERIFY(list0301.size() == 8);
- VERIFY(T::dtorCount() == 1);
+ VERIFY(value_type::dtorCount() == 1);
VERIFY(b == list0301.begin() && b->id() == 11);
VERIFY(e == list0301.end());
VERIFY(m->id() == 13);
// range erase
- T::reset();
+ value_type::reset();
m = list0301.erase(list0301.begin(), m); // should be [13 13]
VERIFY(list0301.size() == 2);
- VERIFY(T::dtorCount() == 6);
+ VERIFY(value_type::dtorCount() == 6);
VERIFY(m->id() == 13);
// range fill at beginning
const int A[] = {321, 322, 333};
const int N = sizeof(A) / sizeof(int);
- T::reset();
- b = list0301.begin();
+ value_type::reset();
+ b = list0301.begin();
list0301.insert(b, A, A + N); // should be [321 322 333 13 13]
VERIFY(list0301.size() == 5);
- VERIFY(T::copyCount() == 3);
+ VERIFY(value_type::copyCount() == 3);
VERIFY(m->id() == 13);
-
+
// range fill at end
- T::reset();
+ value_type::reset();
list0301.insert(e, A, A + N); // should be [321 322 333 13 13 321 322 333]
VERIFY(list0301.size() == 8);
- VERIFY(T::copyCount() == 3);
+ VERIFY(value_type::copyCount() == 3);
VERIFY(e == list0301.end());
VERIFY(m->id() == 13);
-
+
// range fill in middle
- T::reset();
- list0301.insert(m, A, A + N);
+ value_type::reset();
+ list0301.insert(m, A, A + N);
VERIFY(list0301.size() == 11);
- VERIFY(T::copyCount() == 3);
+ VERIFY(value_type::copyCount() == 3);
VERIFY(e == list0301.end());
VERIFY(m->id() == 13);
- T::reset();
+ value_type::reset();
list0301.clear();
VERIFY(list0301.size() == 0);
- VERIFY(T::dtorCount() == 11);
+ VERIFY(value_type::dtorCount() == 11);
VERIFY(e == list0301.end());
}
int main()
{
- test03();
+ modifiers1<std::list<__gnu_test::copy_tracker> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc
index 648b2757f71..da39397d098 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/2.cc
@@ -20,71 +20,74 @@
#include <list>
#include <testsuite_hooks.h>
-typedef __gnu_test::copy_tracker T;
-
-bool test __attribute__((unused)) = true;
-
// general single insert/erase + swap
+template<typename _Tp>
void
-test02()
+modifiers2()
{
- std::list<T> list0201;
- T::reset();
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::value_type value_type;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::const_iterator const_iterator;
+
+ list_type list0201;
+ value_type::reset();
- list0201.insert(list0201.begin(), T(1)); // list should be [1]
+ list0201.insert(list0201.begin(), value_type(1)); // list should be [1]
VERIFY(list0201.size() == 1);
- VERIFY(T::copyCount() == 1);
+ VERIFY(value_type::copyCount() == 1);
- list0201.insert(list0201.end(), T(2)); // list should be [1 2]
+ list0201.insert(list0201.end(), value_type(2)); // list should be [1 2]
VERIFY(list0201.size() == 2);
- VERIFY(T::copyCount() == 2);
+ VERIFY(value_type::copyCount() == 2);
- std::list<T>::iterator i = list0201.begin();
- std::list<T>::const_iterator j = i;
+ iterator i = list0201.begin();
+ const_iterator j = i;
VERIFY(i->id() == 1); ++i;
VERIFY(i->id() == 2);
- list0201.insert(i, T(3)); // list should be [1 3 2]
+ list0201.insert(i, value_type(3)); // list should be [1 3 2]
VERIFY(list0201.size() == 3);
- VERIFY(T::copyCount() == 3);
+ VERIFY(value_type::copyCount() == 3);
- std::list<T>::const_iterator k = i;
+ const_iterator k = i;
VERIFY(i->id() == 2); --i;
VERIFY(i->id() == 3); --i;
- VERIFY(i->id() == 1);
- VERIFY(j->id() == 1);
+ VERIFY(i->id() == 1);
+ VERIFY(j->id() == 1);
++i; // will point to '3'
- T::reset();
+ value_type::reset();
list0201.erase(i); // should be [1 2]
VERIFY(list0201.size() == 2);
- VERIFY(T::dtorCount() == 1);
+ VERIFY(value_type::dtorCount() == 1);
VERIFY(k->id() == 2);
- VERIFY(j->id() == 1);
+ VERIFY(j->id() == 1);
- std::list<T> list0202;
- T::reset();
+ list_type list0202;
+ value_type::reset();
VERIFY(list0202.size() == 0);
- VERIFY(T::copyCount() == 0);
- VERIFY(T::dtorCount() == 0);
+ VERIFY(value_type::copyCount() == 0);
+ VERIFY(value_type::dtorCount() == 0);
// member swap
list0202.swap(list0201);
VERIFY(list0201.size() == 0);
VERIFY(list0202.size() == 2);
- VERIFY(T::copyCount() == 0);
- VERIFY(T::dtorCount() == 0);
+ VERIFY(value_type::copyCount() == 0);
+ VERIFY(value_type::dtorCount() == 0);
// specialized swap
swap(list0201, list0202);
VERIFY(list0201.size() == 2);
VERIFY(list0202.size() == 0);
- VERIFY(T::copyCount() == 0);
- VERIFY(T::dtorCount() == 0);
+ VERIFY(value_type::copyCount() == 0);
+ VERIFY(value_type::dtorCount() == 0);
}
int main()
{
- test02();
+ modifiers2<std::list<__gnu_test::copy_tracker> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc
index 995ce7be757..b6a41e3dc45 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/3.cc
@@ -20,44 +20,47 @@
#include <list>
#include <testsuite_hooks.h>
-typedef __gnu_test::copy_tracker T;
-
-bool test __attribute__((unused)) = true;
-
-
// This test verifies the following.
//
// 23.2.2.3 void push_front(const T& x)
// 23.2.2.3 void push_back(const T& x)
-// 23.2.2.3 (1) iterator and reference non-invalidation
+// 23.2.2.3 (1) iterator and reference non-invalidation
// 23.2.2.3 (1) exception effects
// 23.2.2.3 (2) complexity requirements
//
// 23.2.2.3 void pop_front()
// 23.2.2.3 void pop_back()
-// 23.2.2.3 (3) iterator and reference non-invalidation
+// 23.2.2.3 (3) iterator and reference non-invalidation
// 23.2.2.3 (5) complexity requirements
//
// 23.2.2 const_iterator begin() const
-// 23.2.2 iterator end()
+// 23.2.2 iterator end()
// 23.2.2 const_reverse_iterator rbegin() const
-// 23.2.2 _reference front()
+// 23.2.2 _reference front()
// 23.2.2 const_reference front() const
-// 23.2.2 reference back()
+// 23.2.2 reference back()
// 23.2.2 const_reference back() const
//
+template<typename _Tp>
void
-test01()
+modifiers3()
{
- std::list<T> list0101;
- std::list<T>::const_iterator i;
- std::list<T>::const_reverse_iterator j;
- std::list<T>::iterator k;
- T::reset();
-
- list0101.push_back(T(1)); // list should be [1]
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+ typedef typename list_type::value_type value_type;
+ typedef typename list_type::const_iterator const_iterator;
+ typedef typename list_type::const_reverse_iterator const_reverse_iterator;
+
+ list_type list0101;
+ const_iterator i;
+ const_reverse_iterator j;
+ iterator k;
+ value_type::reset();
+
+ list0101.push_back(value_type(1)); // list should be [1]
VERIFY(list0101.size() == 1);
- VERIFY(T::copyCount() == 1);
+ VERIFY(value_type::copyCount() == 1);
k = list0101.end();
--k;
@@ -65,25 +68,25 @@ test01()
VERIFY(k->id() == list0101.front().id());
VERIFY(k->id() == list0101.back().id());
- list0101.push_front(T(2)); // list should be [2 1]
+ list0101.push_front(value_type(2)); // list should be [2 1]
VERIFY(list0101.size() == 2);
- VERIFY(T::copyCount() == 2);
+ VERIFY(value_type::copyCount() == 2);
VERIFY(k->id() == 1);
- list0101.push_back(T(3)); // list should be [2 1 3]
+ list0101.push_back(value_type(3)); // list should be [2 1 3]
VERIFY(list0101.size() == 3);
- VERIFY(T::copyCount() == 3);
+ VERIFY(value_type::copyCount() == 3);
VERIFY(k->id() == 1);
try
{
- list0101.push_back(T(4, true));
+ list0101.push_back(value_type(4, true));
VERIFY(false);
}
catch (...)
{
VERIFY(list0101.size() == 3);
- VERIFY(T::copyCount() == 4);
+ VERIFY(value_type::copyCount() == 4);
}
i = list0101.begin();
@@ -100,23 +103,23 @@ test01()
++j;
VERIFY(j->id() == 1);
- T::reset();
+ value_type::reset();
list0101.pop_back(); // list should be [2 1]
VERIFY(list0101.size() == 2);
- VERIFY(T::dtorCount() == 1);
+ VERIFY(value_type::dtorCount() == 1);
VERIFY(i->id() == 1);
VERIFY(k->id() == 1);
list0101.pop_front(); // list should be [1]
VERIFY(list0101.size() == 1);
- VERIFY(T::dtorCount() == 2);
+ VERIFY(value_type::dtorCount() == 2);
VERIFY(i->id() == 1);
VERIFY(k->id() == 1);
}
int main()
{
- test01();
+ modifiers3<std::list<__gnu_test::copy_tracker> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
index a2a145c27e2..a41c6b15a23 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/insert/25288.cc
@@ -24,19 +24,21 @@
#include <ext/throw_allocator.h>
// libstdc++/25288
-void test01()
+template<typename _Tp>
+void insert1()
{
bool test __attribute__((unused)) = true;
- typedef int value_type;
- typedef __gnu_cxx::throw_allocator<value_type> allocator_type;
- typedef std::list<value_type, allocator_type> list_type;
+ typedef _Tp list_type;
+ typedef typename _Tp::value_type value_type;
+ typedef typename _Tp::allocator_type allocator_type;
+ typedef typename _Tp::size_type size_type;
for (int j = 0; j < 10; ++j)
for (int i = 0; i < 10; ++i)
{
allocator_type alloc1;
- allocator_type::zero_throw_prob_adjustor adjust1;
+ typename allocator_type::zero_throw_prob_adjustor adjust1;
list_type list1(alloc1);
for (int k = 0; k < j; ++k)
@@ -57,12 +59,12 @@ void test01()
VERIFY( false );
}
- VERIFY( list1.size() == list_type::size_type(j) );
+ VERIFY( list1.size() == size_type(j) );
VERIFY( list1.size() == 0 || list1.back() == -j );
VERIFY( list1.size() == 0 || list1.front() == -1 );
allocator_type alloc2;
- allocator_type::zero_throw_prob_adjustor adjust2;
+ typename allocator_type::zero_throw_prob_adjustor adjust2;
list_type list2(alloc2);
const int data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
@@ -85,7 +87,7 @@ void test01()
VERIFY( false );
}
- VERIFY( list2.size() == list_type::size_type(j) );
+ VERIFY( list2.size() == size_type(j) );
VERIFY( list2.size() == 0 || list2.back() == -j );
VERIFY( list2.size() == 0 || list2.front() == -1 );
}
@@ -93,6 +95,10 @@ void test01()
int main()
{
- test01();
+ typedef int value_type;
+ typedef __gnu_cxx::throw_allocator<value_type> allocator_type;
+ typedef std::list<value_type, allocator_type> list_type;
+
+ insert1<list_type>();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
index ea37be032d7..c66ead57c76 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/1.cc
@@ -31,23 +31,31 @@ namespace std
}
// Should use list specialization for swap.
-void test01()
+template<typename _Tp>
+void
+swap11()
{
bool test __attribute__((unused)) = true;
- std::list<T> A;
- std::list<T> B;
+ typedef _Tp list_type;
+
+ list_type A;
+ list_type B;
swap_calls = 0;
std::swap(A, B);
VERIFY(1 == swap_calls);
}
// Should use list specialization for swap.
-void test02()
+template<typename _Tp>
+void
+swap12()
{
- bool test __attribute__((unused)) = true;
using namespace std;
- list<T> A;
- list<T> B;
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
+ list_type A;
+ list_type B;
swap_calls = 0;
swap(A, B);
VERIFY(1 == swap_calls);
@@ -60,7 +68,7 @@ template class __gnu_cxx::__mt_alloc<std::_List_node<T> >;
// See c++/13658 for background info.
int main()
{
- test01();
- test02();
+ swap11<std::list<T> >();
+ swap12<std::list<T> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
index 5ae95915861..e31c0fb5924 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/2.cc
@@ -24,14 +24,16 @@
#include <testsuite_allocator.h>
// uneq_allocator as a non-empty allocator.
+template<typename _Tp>
void
-test01()
+swap2()
{
bool test __attribute__((unused)) = true;
using namespace std;
- typedef __gnu_test::uneq_allocator<char> my_alloc;
- typedef list<char, my_alloc> my_list;
+ typedef _Tp list_type;
+ typedef typename list_type::allocator_type allocator_type;
+ typedef typename list_type::size_type size_type;
const char title01[] = "Rivers of sand";
const char title02[] = "Concret PH";
@@ -43,13 +45,13 @@ test01()
const size_t N3 = sizeof(title03);
const size_t N4 = sizeof(title04);
- my_list::size_type size01, size02;
+ size_type size01, size02;
- my_alloc alloc01(1);
+ allocator_type alloc01(1);
- my_list lis01(alloc01);
+ list_type lis01(alloc01);
size01 = lis01.size();
- my_list lis02(alloc01);
+ list_type lis02(alloc01);
size02 = lis02.size();
lis01.swap(lis02);
@@ -58,9 +60,9 @@ test01()
VERIFY( lis02.size() == size01 );
VERIFY( lis02.empty() );
- my_list lis03(alloc01);
+ list_type lis03(alloc01);
size01 = lis03.size();
- my_list lis04(title02, title02 + N2, alloc01);
+ list_type lis04(title02, title02 + N2, alloc01);
size02 = lis04.size();
lis03.swap(lis04);
@@ -69,9 +71,9 @@ test01()
VERIFY( lis04.size() == size01 );
VERIFY( lis04.empty() );
- my_list lis05(title01, title01 + N1, alloc01);
+ list_type lis05(title01, title01 + N1, alloc01);
size01 = lis05.size();
- my_list lis06(title02, title02 + N2, alloc01);
+ list_type lis06(title02, title02 + N2, alloc01);
size02 = lis06.size();
lis05.swap(lis06);
@@ -80,9 +82,9 @@ test01()
VERIFY( lis06.size() == size01 );
VERIFY( equal(lis06.begin(), lis06.end(), title01) );
- my_list lis07(title01, title01 + N1, alloc01);
+ list_type lis07(title01, title01 + N1, alloc01);
size01 = lis07.size();
- my_list lis08(title03, title03 + N3, alloc01);
+ list_type lis08(title03, title03 + N3, alloc01);
size02 = lis08.size();
lis07.swap(lis08);
@@ -91,9 +93,9 @@ test01()
VERIFY( lis08.size() == size01 );
VERIFY( equal(lis08.begin(), lis08.end(), title01) );
- my_list lis09(title03, title03 + N3, alloc01);
+ list_type lis09(title03, title03 + N3, alloc01);
size01 = lis09.size();
- my_list lis10(title04, title04 + N4, alloc01);
+ list_type lis10(title04, title04 + N4, alloc01);
size02 = lis10.size();
lis09.swap(lis10);
@@ -102,9 +104,9 @@ test01()
VERIFY( lis10.size() == size01 );
VERIFY( equal(lis10.begin(), lis10.end(), title03) );
- my_list lis11(title04, title04 + N4, alloc01);
+ list_type lis11(title04, title04 + N4, alloc01);
size01 = lis11.size();
- my_list lis12(title01, title01 + N1, alloc01);
+ list_type lis12(title01, title01 + N1, alloc01);
size02 = lis12.size();
lis11.swap(lis12);
@@ -113,9 +115,9 @@ test01()
VERIFY( lis12.size() == size01 );
VERIFY( equal(lis12.begin(), lis12.end(), title04) );
- my_list lis13(title03, title03 + N3, alloc01);
+ list_type lis13(title03, title03 + N3, alloc01);
size01 = lis13.size();
- my_list lis14(title03, title03 + N3, alloc01);
+ list_type lis14(title03, title03 + N3, alloc01);
size02 = lis14.size();
lis13.swap(lis14);
@@ -127,6 +129,10 @@ test01()
int main()
{
- test01();
+ typedef char value_type;
+ typedef __gnu_test::uneq_allocator<value_type> allocator_type;
+ typedef std::list<value_type, allocator_type> list_type;
+
+ swap2<list_type>();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
index ed7f24a07fe..c0e0f65bf64 100644
--- a/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/swap/3.cc
@@ -24,14 +24,16 @@
#include <testsuite_allocator.h>
// uneq_allocator, two different personalities.
+template<typename _Tp>
void
-test01()
+swap3()
{
bool test __attribute__((unused)) = true;
using namespace std;
- typedef __gnu_test::uneq_allocator<char> my_alloc;
- typedef list<char, my_alloc> my_list;
+ typedef _Tp list_type;
+ typedef typename list_type::allocator_type allocator_type;
+ typedef typename list_type::size_type size_type;
const char title01[] = "Rivers of sand";
const char title02[] = "Concret PH";
@@ -43,15 +45,15 @@ test01()
const size_t N3 = sizeof(title03);
const size_t N4 = sizeof(title04);
- my_list::size_type size01, size02;
+ size_type size01, size02;
- my_alloc alloc01(1), alloc02(2);
+ allocator_type alloc01(1), alloc02(2);
int personality01, personality02;
- my_list lis01(alloc01);
+ list_type lis01(alloc01);
size01 = lis01.size();
personality01 = lis01.get_allocator().get_personality();
- my_list lis02(alloc02);
+ list_type lis02(alloc02);
size02 = lis02.size();
personality02 = lis02.get_allocator().get_personality();
@@ -63,10 +65,10 @@ test01()
VERIFY( lis01.get_allocator().get_personality() == personality02 );
VERIFY( lis02.get_allocator().get_personality() == personality01 );
- my_list lis03(alloc02);
+ list_type lis03(alloc02);
size01 = lis03.size();
personality01 = lis03.get_allocator().get_personality();
- my_list lis04(title02, title02 + N2, alloc01);
+ list_type lis04(title02, title02 + N2, alloc01);
size02 = lis04.size();
personality02 = lis04.get_allocator().get_personality();
@@ -78,10 +80,10 @@ test01()
VERIFY( lis03.get_allocator().get_personality() == personality02 );
VERIFY( lis04.get_allocator().get_personality() == personality01 );
- my_list lis05(title01, title01 + N1, alloc01);
+ list_type lis05(title01, title01 + N1, alloc01);
size01 = lis05.size();
personality01 = lis05.get_allocator().get_personality();
- my_list lis06(title02, title02 + N2, alloc02);
+ list_type lis06(title02, title02 + N2, alloc02);
size02 = lis06.size();
personality02 = lis06.get_allocator().get_personality();
@@ -93,10 +95,10 @@ test01()
VERIFY( lis05.get_allocator().get_personality() == personality02 );
VERIFY( lis06.get_allocator().get_personality() == personality01 );
- my_list lis07(title01, title01 + N1, alloc02);
+ list_type lis07(title01, title01 + N1, alloc02);
size01 = lis07.size();
personality01 = lis07.get_allocator().get_personality();
- my_list lis08(title03, title03 + N3, alloc01);
+ list_type lis08(title03, title03 + N3, alloc01);
size02 = lis08.size();
personality02 = lis08.get_allocator().get_personality();
@@ -108,10 +110,10 @@ test01()
VERIFY( lis07.get_allocator().get_personality() == personality02 );
VERIFY( lis08.get_allocator().get_personality() == personality01 );
- my_list lis09(title03, title03 + N3, alloc01);
+ list_type lis09(title03, title03 + N3, alloc01);
size01 = lis09.size();
personality01 = lis09.get_allocator().get_personality();
- my_list lis10(title04, title04 + N4, alloc02);
+ list_type lis10(title04, title04 + N4, alloc02);
size02 = lis10.size();
personality02 = lis10.get_allocator().get_personality();
@@ -123,10 +125,10 @@ test01()
VERIFY( lis09.get_allocator().get_personality() == personality02 );
VERIFY( lis10.get_allocator().get_personality() == personality01 );
- my_list lis11(title04, title04 + N4, alloc02);
+ list_type lis11(title04, title04 + N4, alloc02);
size01 = lis11.size();
personality01 = lis11.get_allocator().get_personality();
- my_list lis12(title01, title01 + N1, alloc01);
+ list_type lis12(title01, title01 + N1, alloc01);
size02 = lis12.size();
personality02 = lis12.get_allocator().get_personality();
@@ -138,10 +140,10 @@ test01()
VERIFY( lis11.get_allocator().get_personality() == personality02 );
VERIFY( lis12.get_allocator().get_personality() == personality01 );
- my_list lis13(title03, title03 + N3, alloc01);
+ list_type lis13(title03, title03 + N3, alloc01);
size01 = lis13.size();
personality01 = lis13.get_allocator().get_personality();
- my_list lis14(title03, title03 + N3, alloc02);
+ list_type lis14(title03, title03 + N3, alloc02);
size02 = lis14.size();
personality02 = lis14.get_allocator().get_personality();
@@ -156,6 +158,10 @@ test01()
int main()
{
- test01();
+ typedef char value_type;
+ typedef __gnu_test::uneq_allocator<value_type> allocator_type;
+ typedef std::list<value_type, allocator_type> list_type;
+
+ swap3<list_type>();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/moveable.cc b/libstdc++-v3/testsuite/23_containers/list/moveable.cc
index 647e2609400..dc245b1ca00 100644
--- a/libstdc++-v3/testsuite/23_containers/list/moveable.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/moveable.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2005, 2007, 2009 Free Software Foundation, Inc.
+// 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
@@ -17,7 +17,6 @@
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-
// NOTE: This makes use of the fact that we know how moveable
// is implemented on list (via swap). If the implementation changed
// this test may begin to fail.
@@ -26,17 +25,26 @@
#include <utility>
#include <testsuite_hooks.h>
+template<typename _Tp>
+ void
+ test_moveable()
+ {
+ bool test __attribute__((unused)) = true;
+
+ typedef _Tp list_type;
+
+ list_type a,b;
+ a.push_back(1);
+ b = std::move(a);
+ VERIFY( b.size() == 1 && *b.begin() == 1 && a.size() == 0 );
+
+ list_type c(std::move(b));
+ VERIFY( c.size() == 1 && *c.begin() == 1 );
+ VERIFY( b.size() == 0 );
+ }
+
int main()
{
- bool test __attribute__((unused)) = true;
-
- std::list<int> a,b;
- a.push_back(1);
- b = std::move(a);
- VERIFY( b.size() == 1 && *b.begin() == 1 && a.size() == 0 );
-
- std::list<int> c(std::move(b));
- VERIFY( c.size() == 1 && *c.begin() == 1 );
- VERIFY( b.size() == 0 );
+ test_moveable<std::list<int> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/1.cc b/libstdc++-v3/testsuite/23_containers/list/operations/1.cc
index 750167c4df4..d44e1c70612 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/1.cc
@@ -20,21 +20,24 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// splice(p, x) + remove + reverse
+template<typename _Tp>
void
-test01()
+operations01()
{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
const int K = 417;
const int A[] = {1, 2, 3, 4, 5};
const int B[] = {K, K, K, K, K};
const std::size_t N = sizeof(A) / sizeof(int);
const std::size_t M = sizeof(B) / sizeof(int);
- std::list<int> list0101(A, A + N);
- std::list<int> list0102(B, B + M);
- std::list<int>::iterator p = list0101.begin();
+ list_type list0101(A, A + N);
+ list_type list0102(B, B + M);
+ iterator p = list0101.begin();
VERIFY(list0101.size() == N);
VERIFY(list0102.size() == M);
@@ -65,9 +68,9 @@ test01()
VERIFY(p == list0101.end());
}
-int main(void)
+int main()
{
- test01();
+ operations01<std::list<int> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/2.cc b/libstdc++-v3/testsuite/23_containers/list/operations/2.cc
index e36b08ef414..743b176b38f 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/2.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/2.cc
@@ -20,21 +20,24 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// splice(p, x, i) + remove_if + operator==
+template<typename _Tp>
void
-test02()
+operations02()
{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
const int A[] = {1, 2, 3, 4, 5};
const int B[] = {2, 1, 3, 4, 5};
const int C[] = {1, 3, 4, 5, 2};
const int N = sizeof(A) / sizeof(int);
- std::list<int> list0201(A, A + N);
- std::list<int> list0202(A, A + N);
- std::list<int> list0203(B, B + N);
- std::list<int> list0204(C, C + N);
- std::list<int>::iterator i = list0201.begin();
+ list_type list0201(A, A + N);
+ list_type list0202(A, A + N);
+ list_type list0203(B, B + N);
+ list_type list0204(C, C + N);
+ iterator i = list0201.begin();
// result should be unchanged
list0201.splice(list0201.begin(), list0201, i);
@@ -53,6 +56,6 @@ test02()
int main()
{
- test02();
+ operations02<std::list<int> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/3.cc b/libstdc++-v3/testsuite/23_containers/list/operations/3.cc
index 0f0999c32eb..83d00133c49 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/3.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/3.cc
@@ -20,12 +20,15 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
// splice(p, x, f, l) + sort + merge + unique
+template<typename _Tp>
void
-test03()
+operations03()
{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+ typedef typename list_type::iterator iterator;
+
const int A[] = {103, 203, 603, 303, 403, 503};
const int B[] = {417, 417, 417, 417, 417};
const int E[] = {103, 417, 417, 203, 603, 303, 403, 503};
@@ -38,14 +41,14 @@ test03()
const int Q = sizeof(D) / sizeof(int);
const int R = sizeof(E) / sizeof(int);
- std::list<int> list0301(A, A + N);
- std::list<int> list0302(B, B + M);
- std::list<int> list0303(C, C + P);
- std::list<int> list0304(D, D + Q);
- std::list<int> list0305(E, E + R);
- std::list<int> list0306(F, F + R);
- std::list<int>::iterator p = list0301.begin();
- std::list<int>::iterator q = list0302.begin();
+ list_type list0301(A, A + N);
+ list_type list0302(B, B + M);
+ list_type list0303(C, C + P);
+ list_type list0304(D, D + Q);
+ list_type list0305(E, E + R);
+ list_type list0306(F, F + R);
+ iterator p = list0301.begin();
+ iterator q = list0302.begin();
++p; ++q; ++q;
list0301.splice(p, list0302, list0302.begin(), q);
@@ -67,6 +70,6 @@ test03()
int main(void)
{
- test03();
+ operations03<std::list<int> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/4.cc b/libstdc++-v3/testsuite/23_containers/list/operations/4.cc
index 59c047bab7c..37b983a39a2 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/4.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/4.cc
@@ -20,10 +20,8 @@
#include <list>
#include <testsuite_hooks.h>
-bool test __attribute__((unused)) = true;
-
-// A comparison predicate to order by rightmost digit. Tracks call counts for
-// performance checks.
+// A comparison predicate to order by rightmost digit. Tracks call
+// counts for performance checks.
struct CompLastLt
{
bool operator()(const int x, const int y)
@@ -48,9 +46,13 @@ int CompLastEq::itsCount;
// sort(pred) + merge(pred) + unique(pred)
// also checks performance requirements
+template<typename _Tp>
void
-test04()
+operations04()
{
+ bool test __attribute__((unused)) = true;
+ typedef _Tp list_type;
+
const int A[] = {1, 2, 3, 4, 5, 6};
const int B[] = {12, 15, 13, 14, 11};
const int C[] = {11, 12, 13, 14, 15};
@@ -59,11 +61,11 @@ test04()
const int M = sizeof(B) / sizeof(int);
const int Q = sizeof(D) / sizeof(int);
- std::list<int> list0401(A, A + N);
- std::list<int> list0402(B, B + M);
- std::list<int> list0403(C, C + M);
- std::list<int> list0404(D, D + Q);
- std::list<int> list0405(A, A + N);
+ list_type list0401(A, A + N);
+ list_type list0402(B, B + M);
+ list_type list0403(C, C + M);
+ list_type list0404(D, D + Q);
+ list_type list0405(A, A + N);
// sort B
CompLastLt lt;
@@ -91,7 +93,7 @@ test04()
int main()
{
- test04();
+ operations04<std::list<int> >();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/operations/5.cc b/libstdc++-v3/testsuite/23_containers/list/operations/5.cc
index 6e9012e0bd9..ae1939c8824 100644
--- a/libstdc++-v3/testsuite/23_containers/list/operations/5.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/operations/5.cc
@@ -25,26 +25,27 @@
#include <testsuite_allocator.h>
// Check the splice (and merge) bits of N1599.
+template<typename _Tp>
void
-test01()
+operations05()
{
bool test __attribute__((unused)) = true;
- typedef __gnu_test::uneq_allocator<int> my_alloc;
- typedef std::list<int, my_alloc> my_list;
+ typedef _Tp list_type;
+ typedef typename list_type::allocator_type allocator_type;
const int data1[] = {1, 2, 3, 4, 5};
const int data2[] = {6, 7, 8, 9, 10};
const size_t N1 = sizeof(data1) / sizeof(int);
const size_t N2 = sizeof(data2) / sizeof(int);
- my_alloc alloc01(1), alloc02(2);
+ allocator_type alloc01(1), alloc02(2);
- my_list l01(data1, data1 + N1, alloc01);
- const my_list l01_ref = l01;
+ list_type l01(data1, data1 + N1, alloc01);
+ const list_type l01_ref = l01;
- my_list l02(data2, data2 + N2, alloc02);
- const my_list l02_ref = l02;
+ list_type l02(data2, data2 + N2, alloc02);
+ const list_type l02_ref = l02;
bool catched = false;
@@ -135,6 +136,10 @@ test01()
int main()
{
- test01();
+ typedef int value_type;
+ typedef __gnu_test::uneq_allocator<value_type> allocator_type;
+ typedef std::list<value_type, allocator_type> list_type;
+
+ operations05<list_type>();
return 0;
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/pthread1.cc b/libstdc++-v3/testsuite/23_containers/list/pthread1.cc
index 63198fab096..fcbb039dce3 100644
--- a/libstdc++-v3/testsuite/23_containers/list/pthread1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/pthread1.cc
@@ -33,8 +33,6 @@
#include <cstdlib>
#include <pthread.h>
-using namespace std;
-
const int thread_cycles = 10;
const int thread_pairs = 10;
const unsigned max_size = 100;
@@ -42,6 +40,8 @@ const int iters = 10000;
class task_queue
{
+ typedef std::list<int> list_type;
+
public:
task_queue ()
{
@@ -55,14 +55,15 @@ public:
pthread_cond_destroy (&fooCond1);
pthread_cond_destroy (&fooCond2);
}
- list<int> foo;
- pthread_mutex_t fooLock;
- pthread_cond_t fooCond1;
- pthread_cond_t fooCond2;
+
+ list_type foo;
+ pthread_mutex_t fooLock;
+ pthread_cond_t fooCond1;
+ pthread_cond_t fooCond2;
};
void*
-produce (void* t)
+produce(void* t)
{
task_queue& tq = *(static_cast<task_queue*> (t));
int num = 0;
@@ -79,7 +80,7 @@ produce (void* t)
}
void*
-consume (void* t)
+consume(void* t)
{
task_queue& tq = *(static_cast<task_queue*> (t));
int num = 0;
@@ -98,7 +99,7 @@ consume (void* t)
}
int
-main ()
+main()
{
pthread_t prod[thread_pairs];
pthread_t cons[thread_pairs];
diff --git a/libstdc++-v3/testsuite/23_containers/list/pthread5.cc b/libstdc++-v3/testsuite/23_containers/list/pthread5.cc
index 8501e323b1b..57411eef3f0 100644
--- a/libstdc++-v3/testsuite/23_containers/list/pthread5.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/pthread5.cc
@@ -34,8 +34,6 @@
#include <unistd.h> // To test for _POSIX_THREAD_PRIORITY_SCHEDULING
#endif
-using namespace std;
-
#define NTHREADS 8
#define LOOPS 20
@@ -48,19 +46,22 @@ struct tt_t
void*
thread_function (void* arg)
{
+ typedef std::vector<tt_t> vector_type;
+ typedef std::list<std::string*> list_type;
+
int myid __attribute__((unused)) = *(int*) arg;
for (int i = 0; i < LOOPS; i++)
{
- vector<tt_t> myvect1;
+ vector_type myvect1;
for (int j = 0; j < 2000; j++)
{
- vector<tt_t> myvect2;
+ vector_type myvect2;
tt_t v;
v.i = j;
myvect1.push_back (v);
myvect2.push_back (v);
- list<std::string *> mylist;
+ list_type mylist;
std::string string_array[4];
string_array[0] = "toto";
string_array[1] = "titi";
@@ -70,7 +71,7 @@ thread_function (void* arg)
{
if (mylist.size ())
{
- list<std::string *>::iterator aIt;
+ list_type::iterator aIt;
for (aIt = mylist.begin (); aIt != mylist.end (); ++aIt)
{
if ((*aIt) == &(string_array[k]))
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc
index 90d6e8c911b..6bcffbb05ee 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/citerators.cc
@@ -28,7 +28,9 @@ test01()
{
bool test __attribute__((unused)) = true;
- std::list<int> l(7);
+ 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() );
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
index e3c86f4056b..cd2b2994807 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc
@@ -30,6 +30,7 @@ struct A
void f()
{
- std::list<A> l;
+ typedef std::list<A> list_type;
+ list_type l;
l.assign(10, 1);
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor.cc
index 11e0022e5b5..5c0bf6f72ce 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor.cc
@@ -23,5 +23,6 @@
void f()
{
- std::list<int> l(10, 1);
+ typedef std::list<int> list_type;
+ list_type l(10, 1);
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
index ef268014e2f..cc2b419bd4e 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc
@@ -25,5 +25,6 @@
void f()
{
- std::list<std::list<int> > l(10, 1);
+ typedef std::list<std::list<int> > list_type;
+ list_type l(10, 1);
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
index 41280156344..d650a9ec102 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc
@@ -26,5 +26,6 @@
void f()
{
- std::list<std::list<std::pair<char, char> > > l('a', 'b');
+ typedef std::list<std::list<std::pair<char, char> > > list_type;
+ list_type l('a', 'b');
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
index f16fcfb2af3..ae9e63f704e 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/insert_neg.cc
@@ -30,6 +30,7 @@ struct A
void f()
{
- std::list<A> l;
+ typedef std::list<A> list_type;
+ list_type l;
l.insert(l.begin(), 10, 1);
}
diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/partial_specialization/1.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/partial_specialization/1.cc
index 13cf83645d7..69d25cf704e 100644
--- a/libstdc++-v3/testsuite/23_containers/list/requirements/partial_specialization/1.cc
+++ b/libstdc++-v3/testsuite/23_containers/list/requirements/partial_specialization/1.cc
@@ -29,5 +29,5 @@ struct user_type {};
namespace std
{
template<typename Allocator>
- class list<user_type, Allocator> {};
+ class list<user_type, Allocator> { };
}
diff --git a/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp b/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp
index 755d986655b..562f418fa22 100644
--- a/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp
+++ b/libstdc++-v3/testsuite/util/common_type/assoc/common_type.hpp
@@ -674,9 +674,7 @@ namespace __gnu_pbds
typedef typename __gnu_cxx::typelist::create1<cnt_5_u>::type lu_policy1;
typedef
- typename __gnu_cxx::typelist::create2<
- lu_policy0,
- lu_policy1>::type
+ typename __gnu_cxx::typelist::create2<lu_policy0, lu_policy1>::type
lu_policies;
template<typename Policy_Tl>
@@ -684,18 +682,12 @@ namespace __gnu_pbds
{
private:
typedef
- typename __gnu_cxx::typelist::at_index<
- Policy_Tl, 0>::type
+ typename __gnu_cxx::typelist::at_index<Policy_Tl, 0>::type
update_policy_t;
public:
typedef
- __gnu_pbds::list_update<
- Key,
- Data,
- Eq_Fn,
- update_policy_t,
- Allocator>
+ __gnu_pbds::list_update<Key, Data, Eq_Fn, update_policy_t, Allocator>
type;
};