//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // check nested types: // template // class allocator // { // public: // typedef size_t size_type; // typedef ptrdiff_t difference_type; // typedef T* pointer; // typedef const T* const_pointer; // typedef typename add_lvalue_reference::type reference; // typedef typename add_lvalue_reference::type const_reference; // typedef T value_type; // typedef true_type is_always_equal; // // template struct rebind {typedef allocator other;}; // ... // }; #include #include #include int main() { static_assert((std::is_same::size_type, std::size_t>::value), ""); static_assert((std::is_same::difference_type, std::ptrdiff_t>::value), ""); static_assert((std::is_same::pointer, char*>::value), ""); static_assert((std::is_same::const_pointer, const char*>::value), ""); static_assert((std::is_same::value_type, char>::value), ""); static_assert((std::is_same::reference, char&>::value), ""); static_assert((std::is_same::const_reference, const char&>::value), ""); static_assert((std::is_same::rebind::other, std::allocator >::value), ""); static_assert((std::is_same::is_always_equal, std::true_type>::value), ""); static_assert((std::is_same::is_always_equal, std::true_type>::value), ""); std::allocator a; std::allocator a2 = a; a2 = a; std::allocator a3 = a2; ((void)a3); }