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