//===----------------------------------------------------------------------===// // // 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 deque // { // public: // typedef T value_type; // typedef Allocator allocator_type; // typedef typename allocator_type::reference reference; // typedef typename allocator_type::const_reference const_reference; // typedef implementation-defined iterator; // typedef implementation-defined const_iterator; // typedef typename allocator_type::size_type size_type; // typedef typename allocator_type::difference_type difference_type; // typedef typename allocator_type::pointer pointer; // typedef typename allocator_type::const_pointer const_pointer; // typedef std::reverse_iterator reverse_iterator; // typedef std::reverse_iterator const_reverse_iterator; // }; #include #include #include #include "test_allocator.h" #include "../../Copyable.h" #include "min_allocator.h" template void test() { typedef std::deque C; 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::value), ""); 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< 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 C::reverse_iterator, std::reverse_iterator >::value), ""); static_assert((std::is_same< typename C::const_reverse_iterator, std::reverse_iterator >::value), ""); } int main() { test >(); test >(); test >(); static_assert((std::is_same::allocator_type, std::allocator >::value), ""); #if __cplusplus >= 201103L { typedef std::deque> C; 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>::value), ""); static_assert((std::is_same>::value), ""); // min_allocator doesn't have a size_type, so one gets synthesized static_assert((std::is_same::type>::value), ""); static_assert((std::is_same::value), ""); } #endif }