| 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 | |
| 32 | int main(int, char**) { |
| 33 | { |
| 34 | typedef std::scoped_allocator_adaptor<A1<int>> A; |
| 35 | A a1(A1<int>(3)); |
| 36 | A a2 = a1; |
| 37 | assert(a2 == a1); |
| 38 | assert(!(a2 != a1)); |
| 39 | } |
| 40 | { |
| 41 | typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A; |
| 42 | A a1(A1<int>(4), A2<int>(5)); |
| 43 | A a2 = a1; |
| 44 | assert(a2 == a1); |
| 45 | assert(!(a2 != a1)); |
| 46 | } |
| 47 | { |
| 48 | typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A; |
| 49 | A a1(A1<int>(4), A2<int>(5), A3<int>(6)); |
| 50 | A a2 = a1; |
| 51 | assert(a2 == a1); |
| 52 | assert(!(a2 != a1)); |
| 53 | } |
| 54 | { |
| 55 | typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A; |
| 56 | A a1(A1<int>(4), A2<int>(5), A3<int>(6)); |
| 57 | A a2(A1<int>(4), A2<int>(5), A3<int>(5)); |
| 58 | assert(a2 != a1); |
| 59 | assert(!(a2 == a1)); |
| 60 | } |
| 61 | |
| 62 | return 0; |
| 63 | } |
| 64 | |