blob: fdc2b4f0786cc1c14d54867717d260012cd26944 [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnantf5256e12010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00004//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <memory>
11
12// template <class OuterAlloc, class... InnerAllocs>
13// class scoped_allocator_adaptor
14// : public OuterAlloc
15// {
16// public:
17// typedef OuterAlloc outer_allocator_type;
18// typedef typename OuterTraits::size_type size_type;
19// typedef typename OuterTraits::difference_type difference_type;
20// typedef typename OuterTraits::pointer pointer;
21// typedef typename OuterTraits::const_pointer const_pointer;
22// typedef typename OuterTraits::void_pointer void_pointer;
23// typedef typename OuterTraits::const_void_pointer const_void_pointer;
24// };
25
Howard Hinnante92c3d72010-08-19 18:39:17 +000026#include <scoped_allocator>
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000027#include <type_traits>
28
29#include "allocators.h"
30
31int main()
32{
Howard Hinnant73d21a42010-09-04 23:28:19 +000033#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000034
35 static_assert((std::is_base_of<
36 A1<int>,
37 std::scoped_allocator_adaptor<A1<int>>
38 >::value), "");
39
40 static_assert((std::is_same<
41 std::scoped_allocator_adaptor<A1<int>>::outer_allocator_type,
42 A1<int>>::value), "");
43
44 static_assert((std::is_same<
45 std::scoped_allocator_adaptor<A1<int>>::size_type,
46 std::size_t>::value), "");
47
48 static_assert((std::is_same<
49 std::scoped_allocator_adaptor<A1<int>>::difference_type,
50 std::ptrdiff_t>::value), "");
51
52 static_assert((std::is_same<
53 std::scoped_allocator_adaptor<A1<int>>::pointer,
54 int*>::value), "");
55
56 static_assert((std::is_same<
57 std::scoped_allocator_adaptor<A1<int>>::const_pointer,
58 const int*>::value), "");
59
60 static_assert((std::is_same<
61 std::scoped_allocator_adaptor<A1<int>>::void_pointer,
62 void*>::value), "");
63
64 static_assert((std::is_same<
65 std::scoped_allocator_adaptor<A1<int>>::const_void_pointer,
66 const void*>::value), "");
67
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000068 static_assert((std::is_base_of<
69 A2<int>,
70 std::scoped_allocator_adaptor<A2<int>, A1<int>>
71 >::value), "");
72
73 static_assert((std::is_same<
74 std::scoped_allocator_adaptor<A2<int>, A1<int>>::outer_allocator_type,
75 A2<int>>::value), "");
76
77 static_assert((std::is_same<
78 std::scoped_allocator_adaptor<A2<int>, A1<int>>::size_type,
79 unsigned>::value), "");
80
81 static_assert((std::is_same<
82 std::scoped_allocator_adaptor<A2<int>, A1<int>>::difference_type,
83 int>::value), "");
84
85 static_assert((std::is_same<
86 std::scoped_allocator_adaptor<A2<int>, A1<int>>::pointer,
87 int*>::value), "");
88
89 static_assert((std::is_same<
90 std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_pointer,
91 const int*>::value), "");
92
93 static_assert((std::is_same<
94 std::scoped_allocator_adaptor<A2<int>, A1<int>>::void_pointer,
95 void*>::value), "");
96
97 static_assert((std::is_same<
98 std::scoped_allocator_adaptor<A2<int>, A1<int>>::const_void_pointer,
99 const void*>::value), "");
100
Howard Hinnant73d21a42010-09-04 23:28:19 +0000101#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000102}