1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <list> 11 12 // template <class T, class Alloc = allocator<T> > 13 // class list 14 // { 15 // public: 16 // 17 // // types: 18 // typedef T value_type; 19 // typedef Alloc allocator_type; 20 // typedef typename allocator_type::reference reference; 21 // typedef typename allocator_type::const_reference const_reference; 22 // typedef typename allocator_type::pointer pointer; 23 // typedef typename allocator_type::const_pointer const_pointer; 24 25 #include <list> 26 #include <type_traits> 27 28 #include "min_allocator.h" 29 30 struct A { std::list<A> v; }; // incomplete type support 31 32 int main() 33 { 34 { 35 typedef std::list<int> C; 36 static_assert((std::is_same<C::value_type, int>::value), ""); 37 static_assert((std::is_same<C::allocator_type, std::allocator<int> >::value), ""); 38 static_assert((std::is_same<C::reference, std::allocator<int>::reference>::value), ""); 39 static_assert((std::is_same<C::const_reference, std::allocator<int>::const_reference>::value), ""); 40 static_assert((std::is_same<C::pointer, std::allocator<int>::pointer>::value), ""); 41 static_assert((std::is_same<C::const_pointer, std::allocator<int>::const_pointer>::value), ""); 42 43 static_assert((std::is_signed<typename C::difference_type>::value), ""); 44 static_assert((std::is_unsigned<typename C::size_type>::value), ""); 45 static_assert((std::is_same<typename C::difference_type, 46 typename std::iterator_traits<typename C::iterator>::difference_type>::value), ""); 47 static_assert((std::is_same<typename C::difference_type, 48 typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), ""); 49 } 50 51 #if TEST_STD_VER >= 11 52 { 53 typedef std::list<int, min_allocator<int>> C; 54 static_assert((std::is_same<C::value_type, int>::value), ""); 55 static_assert((std::is_same<C::allocator_type, min_allocator<int> >::value), ""); 56 static_assert((std::is_same<C::reference, int&>::value), ""); 57 static_assert((std::is_same<C::const_reference, const int&>::value), ""); 58 static_assert((std::is_same<C::pointer, min_pointer<int>>::value), ""); 59 static_assert((std::is_same<C::const_pointer, min_pointer<const int>>::value), ""); 60 61 static_assert((std::is_signed<typename C::difference_type>::value), ""); 62 static_assert((std::is_unsigned<typename C::size_type>::value), ""); 63 static_assert((std::is_same<typename C::difference_type, 64 typename std::iterator_traits<typename C::iterator>::difference_type>::value), ""); 65 static_assert((std::is_same<typename C::difference_type, 66 typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), ""); 67 } 68 #endif 69 } 70