1 // Copyright (C) 2001-2018 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // 23.2.2.1 list constructors, copy, and assignment
20 #include <testsuite_hooks.h>
26 // Another nontrivial type
31 // This test verifies the following.
32 // 23.2.2.1 explicit list(size_type n, const T& v = T(), const a& = Allocator())
33 // 23.2.2 const_iterator begin() const
34 // 23.2.2 const_iterator end() const
35 // 23.2.2 size_type size() const
37 template<typename _Tp
>
41 const std::size_t LIST_SIZE
= 5;
42 const int INIT_VALUE
= 7;
45 typedef _Tp list_type
;
46 typedef typename
list_type::const_iterator const_iterator
;
50 list_type
list0202(LIST_SIZE
);
51 for (i
= list0202
.begin(), count
= 0;
55 VERIFY(count
== LIST_SIZE
);
56 VERIFY(list0202
.size() == LIST_SIZE
);
59 list_type
list0203(LIST_SIZE
, INIT_VALUE
);
60 for (i
= list0203
.begin(), count
= 0;
63 VERIFY(*i
== INIT_VALUE
);
64 VERIFY(count
== LIST_SIZE
);
65 VERIFY(list0203
.size() == LIST_SIZE
);
68 template<typename _Tp
>
72 // nontrivial value_type
73 typedef _Tp list_type
;
74 const std::size_t LIST_SIZE
= 5;
75 list_type
list0201(LIST_SIZE
);