2019-10-29 Jonathan Wakely <jwakely@redhat.com>
+ * include/bits/alloc_traits.h (__cpp_lib_constexpr_dynamic_alloc):
+ Define.
+ (allocator_traits::_S_construct, allocator_traits::_S_destroy)
+ (__alloc_on_copy, __alloc_on_move, __alloc_on_swap): Use
+ _GLIBCXX14_CONSTEXPR instead of constexpr.
+ * include/bits/stl_construct.h (_Destroy): Likewise.
+
* include/Makefile.am: Add new header.
* include/Makefile.in: Regenerate.
* include/bits/iterator_concepts.h: New header.
= typename __construct_helper<_Tp, _Args...>::type;
template<typename _Tp, typename... _Args>
- static constexpr _Require<__has_construct<_Tp, _Args...>>
+ static _GLIBCXX14_CONSTEXPR _Require<__has_construct<_Tp, _Args...>>
_S_construct(_Alloc& __a, _Tp* __p, _Args&&... __args)
noexcept(noexcept(__a.construct(__p, std::forward<_Args>(__args)...)))
{ __a.construct(__p, std::forward<_Args>(__args)...); }
template<typename _Tp, typename... _Args>
- static constexpr
+ static _GLIBCXX14_CONSTEXPR
_Require<__and_<__not_<__has_construct<_Tp, _Args...>>,
is_constructible<_Tp, _Args...>>>
_S_construct(_Alloc&, _Tp* __p, _Args&&... __args)
{ std::_Construct(__p, std::forward<_Args>(__args)...); }
template<typename _Alloc2, typename _Tp>
- static constexpr auto
+ static _GLIBCXX14_CONSTEXPR auto
_S_destroy(_Alloc2& __a, _Tp* __p, int)
noexcept(noexcept(__a.destroy(__p)))
-> decltype(__a.destroy(__p))
{ __a.destroy(__p); }
template<typename _Alloc2, typename _Tp>
- static constexpr void
+ static _GLIBCXX14_CONSTEXPR void
_S_destroy(_Alloc2&, _Tp* __p, ...)
noexcept(noexcept(__p->~_Tp()))
{ std::_Destroy(__p); }
{ return _S_select(__rhs, 0); }
};
+#if __cplusplus > 201703L
+# define __cpp_lib_constexpr_dynamic_alloc 201907L
+#endif
+
/// Partial specialization for std::allocator.
template<typename _Tp>
struct allocator_traits<allocator<_Tp>>
#endif
template<typename _Alloc>
- constexpr void
+ _GLIBCXX14_CONSTEXPR void
__alloc_on_copy(_Alloc& __one, const _Alloc& __two)
{
typedef allocator_traits<_Alloc> __traits;
#endif
template<typename _Alloc>
- constexpr void
+ _GLIBCXX14_CONSTEXPR void
__alloc_on_move(_Alloc& __one, _Alloc& __two)
{
typedef allocator_traits<_Alloc> __traits;
#endif
template<typename _Alloc>
- constexpr void
+ _GLIBCXX14_CONSTEXPR void
__alloc_on_swap(_Alloc& __one, _Alloc& __two)
{
typedef allocator_traits<_Alloc> __traits;
public:
// overload construct for non-standard pointer types
template<typename _Ptr, typename... _Args>
- static constexpr std::__enable_if_t<__is_custom_pointer<_Ptr>::value>
+ static _GLIBCXX14_CONSTEXPR
+ std::__enable_if_t<__is_custom_pointer<_Ptr>::value>
construct(_Alloc& __a, _Ptr __p, _Args&&... __args)
noexcept(noexcept(_Base_type::construct(__a, std::__to_address(__p),
std::forward<_Args>(__args)...)))
// overload destroy for non-standard pointer types
template<typename _Ptr>
- static constexpr std::__enable_if_t<__is_custom_pointer<_Ptr>::value>
+ static _GLIBCXX14_CONSTEXPR
+ std::__enable_if_t<__is_custom_pointer<_Ptr>::value>
destroy(_Alloc& __a, _Ptr __p)
noexcept(noexcept(_Base_type::destroy(__a, std::__to_address(__p))))
{ _Base_type::destroy(__a, std::__to_address(__p)); }
static constexpr _Alloc _S_select_on_copy(const _Alloc& __a)
{ return _Base_type::select_on_container_copy_construction(__a); }
- static constexpr void _S_on_swap(_Alloc& __a, _Alloc& __b)
+ static _GLIBCXX14_CONSTEXPR void _S_on_swap(_Alloc& __a, _Alloc& __b)
{ std::__alloc_on_swap(__a, __b); }
static constexpr bool _S_propagate_on_copy_assign()