blob: f3ecc98eeaa99e34a440e30ec645a0259588fdd9 [file] [log] [blame]
Eric Fiselier257fd692016-05-07 01:04:55 +00001//===----------------------------------------------------------------------===//
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// <experimental/memory_resource>
13
14// template <class Alloc> class resource_adaptor_imp;
15
16// resource_adaptor_imp<Alloc>::resource_adaptor_imp(Alloc &&)
17
18#include <experimental/memory_resource>
19#include <cassert>
20
21#include "test_memory_resource.hpp"
22
23namespace ex = std::experimental::pmr;
24
25int main()
26{
27 typedef CountingAllocator<char> AllocT;
28 typedef ex::resource_adaptor<AllocT> R;
29 {
30 AllocController P;
31 AllocT a(P);
32 R const r(std::move(a));
33 assert(P.copy_constructed == 0);
34 assert(P.move_constructed == 1);
35 assert(r.get_allocator() == a);
36 }
37 {
38 AllocController P;
39 R const r(AllocT{P});
40 assert(P.copy_constructed == 0);
41 assert(P.move_constructed == 1);
42 assert(r.get_allocator() == AllocT{P});
43 }
44}