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 // inner_allocator_type& inner_allocator();
     18 // const inner_allocator_type& inner_allocator() const;
     19 
     20 #include <scoped_allocator>
     21 #include <cassert>
     22 
     23 #include "allocators.h"
     24 
     25 int main()
     26 {
     27     {
     28         typedef std::scoped_allocator_adaptor<A1<int>> A;
     29         A a(A1<int>(5));
     30         assert(a.inner_allocator() == a);
     31     }
     32     {
     33         typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A;
     34         A a(A1<int>(5), A2<int>(6));
     35         assert(a.inner_allocator() == std::scoped_allocator_adaptor<A2<int>>(A2<int>(6)));
     36     }
     37     {
     38         typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A;
     39         A a(A1<int>(5), A2<int>(6), A3<int>(8));
     40         assert((a.inner_allocator() ==
     41             std::scoped_allocator_adaptor<A2<int>, A3<int>>(A2<int>(6), A3<int>(8))));
     42     }
     43 
     44 }
     45