tmp->~test_type();
}
+#ifdef __cpp_lib_constexpr_vector
+constexpr bool
+test03()
+{
+ using alloc_type = default_init_allocator<T>;
+ std::vector<T, alloc_type> v;
+ return v.get_allocator().state == 0;
+}
+static_assert( test03() );
+#endif
+
int main()
{
test01();
tmp->~test_type();
}
+#ifdef __cpp_lib_constexpr_vector
+constexpr bool
+test03()
+{
+ using alloc_type = default_init_allocator<T>;
+ std::vector<T, alloc_type> v;
+ return v.get_allocator().state == 0;
+}
+static_assert( test03() );
+#endif
+
int main()
{
test01();
default_init_allocator() = default;
template<typename U>
+ constexpr
default_init_allocator(const default_init_allocator<U>& a)
: state(a.state)
{ }
- T*
+ constexpr T*
allocate(std::size_t n)
{ return std::allocator<T>().allocate(n); }
- void
+ constexpr void
deallocate(T* p, std::size_t n)
{ std::allocator<T>().deallocate(p, n); }
};
template<typename T, typename U>
- bool operator==(const default_init_allocator<T>& t,
- const default_init_allocator<U>& u)
+ constexpr bool
+ operator==(const default_init_allocator<T>& t,
+ const default_init_allocator<U>& u)
{ return t.state == u.state; }
template<typename T, typename U>
- bool operator!=(const default_init_allocator<T>& t,
- const default_init_allocator<U>& u)
+ constexpr bool
+ operator!=(const default_init_allocator<T>& t,
+ const default_init_allocator<U>& u)
{ return !(t == u); }
-#endif
+#endif // C++11
template<typename Tp>
struct ExplicitConsAlloc : std::allocator<Tp>