eq.pass.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. // UNSUPPORTED: c++98, c++03
  9. // <memory>
  10. // template <class OuterAlloc, class... InnerAllocs>
  11. // class scoped_allocator_adaptor
  12. // template <class OuterA1, class OuterA2, class... InnerAllocs>
  13. // bool
  14. // operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
  15. // const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
  16. //
  17. // template <class OuterA1, class OuterA2, class... InnerAllocs>
  18. // bool
  19. // operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
  20. // const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
  21. #include <scoped_allocator>
  22. #include <cassert>
  23. #include "test_macros.h"
  24. #include "allocators.h"
  25. int main(int, char**)
  26. {
  27. {
  28. typedef std::scoped_allocator_adaptor<A1<int>> A;
  29. A a1(A1<int>(3));
  30. A a2 = a1;
  31. assert(a2 == a1);
  32. assert(!(a2 != a1));
  33. }
  34. {
  35. typedef std::scoped_allocator_adaptor<A1<int>, A2<int>> A;
  36. A a1(A1<int>(4), A2<int>(5));
  37. A a2 = a1;
  38. assert(a2 == a1);
  39. assert(!(a2 != a1));
  40. }
  41. {
  42. typedef std::scoped_allocator_adaptor<A1<int>, A2<int>, A3<int>> A;
  43. A a1(A1<int>(4), A2<int>(5), A3<int>(6));
  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<int>(4), A2<int>(5), A3<int>(5));
  52. assert(a2 != a1);
  53. assert(!(a2 == a1));
  54. }
  55. return 0;
  56. }