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 // pointer allocate(size_type n);
     18 
     19 #include <scoped_allocator>
     20 #include <cassert>
     21 
     22 #include "allocators.h"
     23 
     24 int main()
     25 {
     26     {
     27         typedef std::scoped_allocator_adaptor<A1<int>> A;
     28         A a;
     29         A1<int>::allocate_called = false;
     30         assert(a.allocate(10) == (int*)10);
     31         assert(A1<int>::allocate_called == true);
     32     }
     33     {
     34         typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A;
     35         A a;
     36         A1<int>::allocate_called = false;
     37         assert(a.allocate(10) == (int*)10);
     38         assert(A1<int>::allocate_called == true);
     39     }
     40     {
     41         typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A;
     42         A a;
     43         A1<int>::allocate_called = false;
     44         assert(a.allocate(10) == (int*)10);
     45         assert(A1<int>::allocate_called == true);
     46     }
     47 
     48 }
     49