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, const allocator_type& a);
14 #include <forward_list>
18 #include "test_allocator.h"
19 #include "min_allocator.h"
25 typedef test_allocator<int> A;
26 typedef std::forward_list<T, A> C;
27 const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
28 C c0(std::begin(t), std::end(t), A(10));
31 for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
33 assert(n == std::end(t) - std::begin(t));
35 assert(c.get_allocator() == A(9));
39 typedef other_allocator<int> A;
40 typedef std::forward_list<T, A> C;
41 const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
42 C c0(std::begin(t), std::end(t), A(10));
45 for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
47 assert(n == std::end(t) - std::begin(t));
49 assert(c.get_allocator() == A(9));
51 #if TEST_STD_VER >= 11
54 typedef min_allocator<int> A;
55 typedef std::forward_list<T, A> C;
56 const T t[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
57 C c0(std::begin(t), std::end(t), A());
60 for (C::const_iterator i = c.begin(), e = c.end(); i != e; ++i, ++n)
62 assert(n == std::end(t) - std::begin(t));
64 assert(c.get_allocator() == A());