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 // UNSUPPORTED: c++03 10 11 // <memory> 12 13 // template <class OuterAlloc, class... InnerAllocs> 14 // class scoped_allocator_adaptor 15 16 // scoped_allocator_adaptor(); 17 18 #include <scoped_allocator> 19 #include <cassert> 20 21 #include "test_macros.h" 22 #include "allocators.h" 23 main(int,char **)24int main(int, char**) 25 { 26 { 27 typedef std::scoped_allocator_adaptor<A1<int>> A; 28 A a; 29 assert(a.outer_allocator() == A1<int>()); 30 assert(a.inner_allocator() == a); 31 assert(A1<int>::copy_called == false); 32 assert(A1<int>::move_called == false); 33 } 34 { 35 typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A; 36 A a; 37 assert(a.outer_allocator() == A1<int>()); 38 assert(a.inner_allocator() == std::scoped_allocator_adaptor<A2<int>>()); 39 assert(A1<int>::copy_called == false); 40 assert(A1<int>::move_called == false); 41 assert(A2<int>::copy_called == false); 42 assert(A2<int>::move_called == false); 43 } 44 { 45 typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A; 46 A a; 47 assert(a.outer_allocator() == A1<int>()); 48 assert((a.inner_allocator() == std::scoped_allocator_adaptor<A2<int>, A3<int>>())); 49 assert(A1<int>::copy_called == false); 50 assert(A1<int>::move_called == false); 51 assert(A2<int>::copy_called == false); 52 assert(A2<int>::move_called == false); 53 assert(A3<int>::copy_called == false); 54 assert(A3<int>::move_called == false); 55 } 56 57 58 return 0; 59 } 60