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 // <list> 11 12 // list(initializer_list<value_type> il, const Allocator& a = allocator_type()); 13 14 #include <list> 15 #include <cassert> 16 17 #include "test_allocator.h" 18 #include "min_allocator.h" 19 20 int main() 21 { 22 #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 23 { 24 std::list<int, test_allocator<int>> d({3, 4, 5, 6}, test_allocator<int>(3)); 25 assert(d.get_allocator() == test_allocator<int>(3)); 26 assert(d.size() == 4); 27 std::list<int>::iterator i = d.begin(); 28 assert(*i++ == 3); 29 assert(*i++ == 4); 30 assert(*i++ == 5); 31 assert(*i++ == 6); 32 } 33 #if __cplusplus >= 201103L 34 { 35 std::list<int, min_allocator<int>> d({3, 4, 5, 6}, min_allocator<int>()); 36 assert(d.get_allocator() == min_allocator<int>()); 37 assert(d.size() == 4); 38 std::list<int, min_allocator<int>>::iterator i = d.begin(); 39 assert(*i++ == 3); 40 assert(*i++ == 4); 41 assert(*i++ == 5); 42 assert(*i++ == 6); 43 } 44 #endif 45 #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS 46 } 47