1 //===----------------------------------------------------------------------===//
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 // <memory>
11
12 // template <class OuterAlloc, class... InnerAllocs>
13 // class scoped_allocator_adaptor
14
15 // template <class OuterA1, class OuterA2, class... InnerAllocs>
16 // bool
17 // operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
18 // const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
19 //
20 // template <class OuterA1, class OuterA2, class... InnerAllocs>
21 // bool
22 // operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
23 // const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
24
25 #include <scoped_allocator>
26 #include <cassert>
27
28 #include "allocators.h"
29
main()30 int main()
31 {
32 #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
33
34 {
35 typedef std::scoped_allocator_adaptor<A1<int>> A;
36 A a1(A1<int>(3));
37 A a2 = a1;
38 assert(a2 == a1);
39 assert(!(a2 != a1));
40 }
41 {
42 typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A;
43 A a1(A1<int>(4), A2<int>(5));
44 A a2 = a1;
45 assert(a2 == a1);
46 assert(!(a2 != a1));
47 }
48 {
49 typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A;
50 A a1(A1<int>(4), A2<int>(5), A3<int>(6));
51 A a2 = a1;
52 assert(a2 == a1);
53 assert(!(a2 != a1));
54 }
55 {
56 typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A;
57 A a1(A1<int>(4), A2<int>(5), A3<int>(6));
58 A a2(A1<int>(4), A2<int>(5), A3<int>(5));
59 assert(a2 != a1);
60 assert(!(a2 == a1));
61 }
62
63 #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
64 }
65