alloc.pass.cpp (1300B)
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 // explicit forward_list(const allocator_type& a); 13 14 #include <forward_list> 15 #include <cassert> 16 17 #include "test_allocator.h" 18 #include "../../../NotConstructible.h" 19 #include "min_allocator.h" 20 21 int main() 22 { 23 { 24 typedef test_allocator<NotConstructible> A; 25 typedef A::value_type T; 26 typedef std::forward_list<T, A> C; 27 C c(A(12)); 28 assert(c.get_allocator() == A(12)); 29 assert(c.empty()); 30 } 31 #if TEST_STD_VER >= 11 32 { 33 typedef min_allocator<NotConstructible> A; 34 typedef A::value_type T; 35 typedef std::forward_list<T, A> C; 36 C c(A{}); 37 assert(c.get_allocator() == A()); 38 assert(c.empty()); 39 } 40 { 41 typedef explicit_allocator<NotConstructible> A; 42 typedef A::value_type T; 43 typedef std::forward_list<T, A> C; 44 C c(A{}); 45 assert(c.get_allocator() == A()); 46 assert(c.empty()); 47 } 48 #endif 49 }