blob: 4de30bccb81694792d6f12f6cf7fa158cb3ebe5c [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 const &)
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 const a(P);
32 R const r(a);
33 assert(P.copy_constructed == 1);
34 assert(P.move_constructed == 0);
35 assert(r.get_allocator() == a);
36 }
37 {
38 AllocController P;
39 AllocT a(P);
40 R const r(a);
41 assert(P.copy_constructed == 1);
42 assert(P.move_constructed == 0);
43 assert(r.get_allocator() == a);
44 }
45 {
46 AllocController P;
47 AllocT const a(P);
48 R const r(std::move(a));
49 assert(P.copy_constructed == 1);
50 assert(P.move_constructed == 0);
51 assert(r.get_allocator() == a);
52 }
53}