1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // UNSUPPORTED: c++03
10 
11 // <memory>
12 
13 // template <class OuterAlloc, class... InnerAllocs>
14 //   class scoped_allocator_adaptor
15 
16 // template <class OuterA1, class OuterA2, class... InnerAllocs>
17 //     bool
18 //     operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
19 //                const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
20 //
21 // template <class OuterA1, class OuterA2, class... InnerAllocs>
22 //     bool
23 //     operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
24 //                const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
25 
26 #include <scoped_allocator>
27 #include <cassert>
28 
29 #include "test_macros.h"
30 #include "allocators.h"
31 
main(int,char **)32 int main(int, char**)
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   return 0;
64 }
65