1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03
// <memory>
// template <class OuterAlloc, class... InnerAllocs>
// class scoped_allocator_adaptor
// : public OuterAlloc
// {
// public:
// typedef OuterAlloc outer_allocator_type;
// typedef typename OuterTraits::size_type size_type;
// typedef typename OuterTraits::difference_type difference_type;
// typedef typename OuterTraits::pointer pointer;
// typedef typename OuterTraits::const_pointer const_pointer;
// typedef typename OuterTraits::void_pointer void_pointer;
// typedef typename OuterTraits::const_void_pointer const_void_pointer;
// };
#include <scoped_allocator>
#include <type_traits>
#include "allocators.h"
int main()
{
static_assert((std::is_base_of<
A1<int>,
std::scoped_allocator_adaptor<A1<int>>
>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::outer_allocator_type,
A1<int>>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::size_type,
std::make_unsigned<std::ptrdiff_t>::type>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::difference_type,
std::ptrdiff_t>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::pointer,
int*>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::const_pointer,
const int*>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::void_pointer,
void*>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A1<int>>::const_void_pointer,
const void*>::value), "");
static_assert((std::is_base_of<
A2<int>,
std::scoped_allocator_adaptor<A2<int>, A1<int>>
>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A2<int>, A1<int>>::outer_allocator_type,
A2<int>>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A2<int>, A1<int>>::size_type,
unsigned>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A2<int>, A1<int>>::difference_type,
int>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A2<int>, A1<int>>::pointer,
int*>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_pointer,
const int*>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A2<int>, A1<int>>::void_pointer,
void*>::value), "");
static_assert((std::is_same<
std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_void_pointer,
const void*>::value), "");
}
|