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 // <memory>
     11 
     12 // template <class OuterAlloc, class... InnerAllocs>
     13 //   class scoped_allocator_adaptor
     14 
     15 // inner_allocator_type& inner_allocator();
     16 // const inner_allocator_type& inner_allocator() const;
     17 
     18 #include <scoped_allocator>
     19 #include <cassert>
     20 
     21 #include "allocators.h"
     22 
     23 int main()
     24 {
     25 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
     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 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
     45 }
     46