2 // { dg-do compile { target c++11 } }
6 typedef __SIZE_TYPE__ size_t;
8 template<typename _Tp, _Tp>
9 struct integral_constant;
11 template<typename _Tp, _Tp __v>
12 struct integral_constant
14 static constexpr _Tp value = __v;
15 typedef _Tp value_type;
16 typedef integral_constant<_Tp, __v> type;
17 constexpr operator value_type() { return value; }
20 typedef integral_constant<bool, true> true_type;
22 typedef integral_constant<bool, false> false_type;
24 template<typename _Tp, _Tp __v>
25 constexpr _Tp integral_constant<_Tp, __v>::value;
27 template<bool, typename _Tp = void>
31 template<typename _Tp>
32 struct enable_if<true, _Tp>
33 { typedef _Tp type; };
35 template<typename _Tp>
42 void* operator new(std::size_t)
43 #if __cplusplus <= 201402L
44 throw (std::bad_alloc) // { dg-warning "deprecated" "" { target { ! c++17 } } }
51 template<typename _Tp>
56 typedef _Tp value_type;
59 allocate(size_t, const void* = 0);
62 template<typename _Alloc>
63 struct allocator_traits
65 typedef typename _Alloc::value_type value_type;
67 template<typename _Tp> static typename _Tp::pointer
68 _S_pointer_helper(_Tp*);
69 static value_type* _S_pointer_helper(...);
70 typedef decltype(_S_pointer_helper((_Alloc*)0)) __pointer;
72 typedef __pointer pointer;
74 typedef const void* const_void_pointer;
77 template<typename _Alloc2>
78 struct __allocate_helper
80 template<typename _Alloc3,
81 typename = decltype(std::declval<_Alloc3*>()->allocate(
82 std::declval<size_t>(),
83 std::declval<const_void_pointer>()))>
84 static true_type __test(int);
87 static false_type __test(...);
89 typedef decltype(__test<_Alloc>(0)) type;
90 static const bool value = type::value;
93 template<typename _Alloc2>
95 enable_if<__allocate_helper<_Alloc2>::value, pointer>::type
96 _S_allocate(_Alloc2& __a, size_t __n, const_void_pointer __hint)
97 { return __a.allocate(__n, __hint); }
101 allocate(_Alloc& __a, size_t __n, const_void_pointer __hint)
102 { return _S_allocate(__a, __n, __hint); }
109 typedef short test_type;
110 template struct allocator_traits<allocator<test_type>>;