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