Home | History | Annotate | Download | only in list
      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     static_assert((std::is_same<std::list<int>::value_type, int>::value), "");
     35     static_assert((std::is_same<std::list<int>::allocator_type, std::allocator<int> >::value), "");
     36     static_assert((std::is_same<std::list<int>::reference, std::allocator<int>::reference>::value), "");
     37     static_assert((std::is_same<std::list<int>::const_reference, std::allocator<int>::const_reference>::value), "");
     38     static_assert((std::is_same<std::list<int>::pointer, std::allocator<int>::pointer>::value), "");
     39     static_assert((std::is_same<std::list<int>::const_pointer, std::allocator<int>::const_pointer>::value), "");
     40 #if __cplusplus >= 201103L
     41     static_assert((std::is_same<std::list<int, min_allocator<int>>::value_type, int>::value), "");
     42     static_assert((std::is_same<std::list<int, min_allocator<int>>::allocator_type, min_allocator<int> >::value), "");
     43     static_assert((std::is_same<std::list<int, min_allocator<int>>::reference, int&>::value), "");
     44     static_assert((std::is_same<std::list<int, min_allocator<int>>::const_reference, const int&>::value), "");
     45     static_assert((std::is_same<std::list<int, min_allocator<int>>::pointer, min_pointer<int>>::value), "");
     46     static_assert((std::is_same<std::list<int, min_allocator<int>>::const_pointer, min_pointer<const int>>::value), "");
     47 #endif
     48 }
     49