libcxx

libcxx mirror with random patches
git clone https://git.neptards.moe/neptards/libcxx.git
Log | Files | Refs

eq.pass.cpp (1866B)


      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 // UNSUPPORTED: c++98, c++03
     11 
     12 // <memory>
     13 
     14 // template <class OuterAlloc, class... InnerAllocs>
     15 //   class scoped_allocator_adaptor
     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 //
     22 // template <class OuterA1, class OuterA2, class... InnerAllocs>
     23 //     bool
     24 //     operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
     25 //                const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
     26 
     27 #include <scoped_allocator>
     28 #include <cassert>
     29 
     30 #include "allocators.h"
     31 
     32 int main()
     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 }