1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <forward_list>
11 
12 // forward_list(size_type n, const value_type& v, const allocator_type& a);
13 
14 #include <forward_list>
15 #include <cassert>
16 
17 #include "test_allocator.h"
18 #include "min_allocator.h"
19 
main()20 int main()
21 {
22     {
23         typedef test_allocator<int> A;
24         typedef A::value_type T;
25         typedef std::forward_list<T, A> C;
26         T v(6);
27         unsigned N = 10;
28         C c(N, v, A(12));
29         unsigned n = 0;
30         for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
31             assert(*i == v);
32         assert(n == N);
33         assert(c.get_allocator() == A(12));
34     }
35 #if __cplusplus >= 201103L
36     {
37         typedef min_allocator<int> A;
38         typedef A::value_type T;
39         typedef std::forward_list<T, A> C;
40         T v(6);
41         unsigned N = 10;
42         C c(N, v, A());
43         unsigned n = 0;
44         for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
45             assert(*i == v);
46         assert(n == N);
47         assert(c.get_allocator() == A());
48     }
49 #endif
50 }
51