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
main(int,char **)24 int main(int, char**)
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 return 0;
48 }
49