1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // forward_list(const forward_list& x);
14 #include <forward_list>
18 #include "test_macros.h"
19 #include "test_allocator.h"
20 #include "min_allocator.h"
26 typedef test_allocator<int> A;
27 typedef std::forward_list<T, A> C;
28 const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
29 C c0(std::begin(t), std::end(t), A(10));
32 for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
34 assert(n == std::end(t) - std::begin(t));
36 assert(c.get_allocator() == A(10));
38 #if TEST_STD_VER >= 11
41 typedef other_allocator<int> A;
42 typedef std::forward_list<T, A> C;
43 const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
44 C c0(std::begin(t), std::end(t), A(10));
47 for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
49 assert(n == std::end(t) - std::begin(t));
51 assert(c.get_allocator() == A(-2));
55 typedef min_allocator<int> A;
56 typedef std::forward_list<T, A> C;
57 const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
58 C c0(std::begin(t), std::end(t), A());
61 for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
63 assert(n == std::end(t) - std::begin(t));
65 assert(c.get_allocator() == A());