| 1 |
//===----------------------------------------------------------------------===// |
| 2 |
// |
| 3 |
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 |
// See https://llvm.org/LICENSE.txt for license information. |
| 5 |
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 |
// |
| 7 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
// UNSUPPORTED: c++03 |
| 10 |
|
| 11 |
// <memory> |
| 12 |
|
| 13 |
// template <class OuterAlloc, class... InnerAllocs> |
| 14 |
// class scoped_allocator_adaptor |
| 15 |
|
| 16 |
// void deallocate(pointer p, size_type n); |
| 17 |
|
| 18 |
#include <scoped_allocator> |
| 19 |
#include <cassert> |
| 20 |
|
| 21 |
#include "test_macros.h" |
| 22 |
#include "allocators.h" |
| 23 |
|
| 24 |
int main(int, char**) { |
| 25 |
{ |
| 26 |
typedef std::scoped_allocator_adaptor<A1<int>> A; |
| 27 |
A a; |
| 28 |
a.deallocate((int*)10, 20); |
| 29 |
assert((A1<int>::deallocate_called == std::pair<int*, std::size_t>((int*)10, 20))); |
| 30 |
} |
| 31 |
{ |
| 32 |
typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A; |
| 33 |
A a; |
| 34 |
a.deallocate((int*)10, 20); |
| 35 |
assert((A1<int>::deallocate_called == std::pair<int*, std::size_t>((int*)10, 20))); |
| 36 |
} |
| 37 |
{ |
| 38 |
typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A; |
| 39 |
A a; |
| 40 |
a.deallocate((int*)10, 20); |
| 41 |
assert((A1<int>::deallocate_called == std::pair<int*, std::size_t>((int*)10, 20))); |
| 42 |
} |
| 43 |
|
| 44 |
return 0; |
| 45 |
} |