//===----------------------------------------------------------------------===// // // 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 vector // { // 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::vector 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 static_assert((std::is_same>::value_type, int>::value), ""); static_assert((std::is_same>::allocator_type, min_allocator >::value), ""); static_assert((std::is_same>::reference, int&>::value), ""); static_assert((std::is_same>::const_reference, const int&>::value), ""); static_assert((std::is_same>::pointer, min_pointer>::value), ""); static_assert((std::is_same>::const_pointer, min_pointer>::value), ""); #endif }