1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <forward_list> 10 11 // explicit forward_list(const allocator_type& a); 12 13 #include <forward_list> 14 #include <cassert> 15 16 #include "test_macros.h" 17 #include "test_allocator.h" 18 #include "../../../NotConstructible.h" 19 #include "min_allocator.h" 20 main(int,char **)21int main(int, char**) 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 50 return 0; 51 } 52