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_swap 16 // | false_type propagate_on_container_swap; 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_swap; 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_swap, std::true_type>::value), ""); 39 static_assert((std::is_same<std::allocator_traits<B<char> >::propagate_on_container_swap, std::false_type>::value), ""); 40 } 41