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::const_pointer 16// | pointer_traits<pointer>::rebind<const value_type> 17// ... 18// }; 19 20#include <memory> 21#include <type_traits> 22 23template <class T> 24struct Ptr {}; 25 26template <class T> 27struct A 28{ 29 typedef T value_type; 30 typedef Ptr<T> pointer; 31}; 32 33template <class T> 34struct B 35{ 36 typedef T value_type; 37}; 38 39template <class T> 40struct CPtr {}; 41 42template <class T> 43struct C 44{ 45 typedef T value_type; 46 typedef CPtr<T> pointer; 47 typedef CPtr<const T> const_pointer; 48}; 49 50int main() 51{ 52 static_assert((std::is_same<std::allocator_traits<A<char> >::const_pointer, Ptr<const char> >::value), ""); 53 static_assert((std::is_same<std::allocator_traits<B<char> >::const_pointer, const char*>::value), ""); 54 static_assert((std::is_same<std::allocator_traits<C<char> >::const_pointer, CPtr<const char> >::value), ""); 55} 56