//===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // // Test nested types and default template args: // template, // class Allocator = allocator > // { // public: // // types: // typedef traits traits_type; // typedef typename traits::char_type value_type; // typedef Allocator allocator_type; // typedef typename Allocator::size_type size_type; // typedef typename Allocator::difference_type difference_type; // typedef typename Allocator::reference reference; // typedef typename Allocator::const_reference const_reference; // typedef typename Allocator::pointer pointer; // typedef typename Allocator::const_pointer const_pointer; // typedef implementation-defined iterator; // See 23.1 // typedef implementation-defined const_iterator; // See 23.1 // typedef std::reverse_iterator reverse_iterator; // typedef std::reverse_iterator const_reverse_iterator; // static const size_type npos = -1; // }; #include #include #include #include "test_traits.h" #include "test_allocator.h" #include "min_allocator.h" template void test() { typedef std::basic_string S; static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::size_type>::value), ""); static_assert((std::is_same::difference_type>::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::value), ""); static_assert((std::is_same::pointer>::value), ""); static_assert((std::is_same::const_pointer>::value), ""); static_assert((std::is_same< typename std::iterator_traits::iterator_category, std::random_access_iterator_tag>::value), ""); static_assert((std::is_same< typename std::iterator_traits::iterator_category, std::random_access_iterator_tag>::value), ""); static_assert((std::is_same< typename S::reverse_iterator, std::reverse_iterator >::value), ""); static_assert((std::is_same< typename S::const_reverse_iterator, std::reverse_iterator >::value), ""); static_assert(S::npos == -1, ""); } int main() { test, test_allocator >(); test, std::allocator >(); static_assert((std::is_same::traits_type, std::char_traits >::value), ""); static_assert((std::is_same::allocator_type, std::allocator >::value), ""); #if __cplusplus >= 201103L test, min_allocator >(); #endif }