1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
12 // check nested types:
18 // typedef size_t size_type;
19 // typedef ptrdiff_t difference_type;
20 // typedef T* pointer;
21 // typedef const T* const_pointer;
22 // typedef typename add_lvalue_reference<T>::type reference;
23 // typedef typename add_lvalue_reference<const T>::type const_reference;
24 // typedef T value_type;
25 // typedef true_type is_always_equal;
27 // template <class U> struct rebind {typedef allocator<U> other;};
32 #include <type_traits>
35 #include "test_macros.h"
39 static_assert((std::is_same<std::allocator<char>::size_type, std::size_t>::value), "");
40 static_assert((std::is_same<std::allocator<char>::difference_type, std::ptrdiff_t>::value), "");
41 static_assert((std::is_same<std::allocator<char>::pointer, char*>::value), "");
42 static_assert((std::is_same<std::allocator<char>::const_pointer, const char*>::value), "");
43 static_assert((std::is_same<std::allocator<char>::value_type, char>::value), "");
44 static_assert((std::is_same<std::allocator<char>::reference, char&>::value), "");
45 static_assert((std::is_same<std::allocator<char>::const_reference, const char&>::value), "");
46 static_assert((std::is_same<std::allocator<char>::rebind<int>::other,
47 std::allocator<int> >::value), "");
49 static_assert((std::is_same<std::allocator< char>::is_always_equal, std::true_type>::value), "");
50 LIBCPP_STATIC_ASSERT((std::is_same<std::allocator<const char>::is_always_equal, std::true_type>::value), "");
52 std::allocator<char> a;
53 std::allocator<char> a2 = a;
55 std::allocator<int> a3 = a2;