//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // 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_macros.h" #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(int, char**) { test, test_allocator >(); #ifndef TEST_HAS_NO_WIDE_CHARACTERS test, std::allocator >(); #endif static_assert((std::is_same::traits_type, std::char_traits >::value), ""); static_assert((std::is_same::allocator_type, std::allocator >::value), ""); #if TEST_STD_VER >= 11 test, min_allocator >(); #endif return 0; }