Home | History | Annotate | Download | only in allocator.adaptor.members
      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 // UNSUPPORTED: c++98, c++03
     11 
     12 // <memory>
     13 
     14 // template <class OuterAlloc, class... InnerAllocs>
     15 //   class scoped_allocator_adaptor
     16 
     17 // outer_allocator_type& outer_allocator();
     18 // const outer_allocator_type& outer_allocator() const;
     19 
     20 #include <scoped_allocator>
     21 #include <cassert>
     22 
     23 #include "allocators.h"
     24 
     25 int main()
     26 {
     27 
     28     {
     29         typedef std::scoped_allocator_adaptor<A1<int>> A;
     30         A a(A1<int>(5));
     31         assert(a.outer_allocator() == A1<int>(5));
     32     }
     33     {
     34         typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A;
     35         A a(A1<int>(5), A2<int>(6));
     36         assert(a.outer_allocator() == A1<int>(5));
     37     }
     38     {
     39         typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A;
     40         A a(A1<int>(5), A2<int>(6), A3<int>(8));
     41         assert(a.outer_allocator() == A1<int>(5));
     42     }
     43 }
     44