1 #include <typeinfo> 2 3 template <class T> 4 struct allocator { 5 typedef T* pointer; 6 7 template <class U> struct rebind { 8 typedef allocator<U> other; 9 }; 10 }; 11 12 template <class T, class Allocator> 13 struct alloc_traits 14 { 15 typedef typename Allocator::template rebind<T>::other allocator_type; 16 }; 17 main()18int main () 19 { 20 typedef alloc_traits<int, allocator<void> >::allocator_type at; 21 22 return typeid (at) != typeid (allocator <int>); 23 } 24