Home | History | Annotate | Download | only in allocator.traits.types
      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 Alloc>
     13 // struct allocator_traits
     14 // {
     15 //     typedef Alloc::propagate_on_container_copy_assignment
     16 //           | false_type                   propagate_on_container_copy_assignment;
     17 //     ...
     18 // };
     19 
     20 #include <memory>
     21 #include <type_traits>
     22 
     23 template <class T>
     24 struct A
     25 {
     26     typedef T value_type;
     27     typedef std::true_type propagate_on_container_copy_assignment;
     28 };
     29 
     30 template <class T>
     31 struct B
     32 {
     33     typedef T value_type;
     34 };
     35 
     36 int main()
     37 {
     38     static_assert((std::is_same<std::allocator_traits<A<char> >::propagate_on_container_copy_assignment, std::true_type>::value), "");
     39     static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_copy_assignment, std::false_type>::value), "");
     40 }
     41