diff --git a/libstdc++-v3/include/bits/allocator.h b/libstdc++-v3/include/bits/allocator.h index 2081386..9e8afed 100644 --- a/libstdc++-v3/include/bits/allocator.h +++ b/libstdc++-v3/include/bits/allocator.h @@ -241,6 +241,52 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #endif + template + struct __alloc_value_initializer; + + template + struct __alloc_value_initializer<_Alloc, true> : public _Alloc + { + // Explicit value initialization. + __alloc_value_initializer() _GLIBCXX_USE_NOEXCEPT + : _Alloc() + { } + + __alloc_value_initializer(const _Alloc& __other) + _GLIBCXX_NOEXCEPT_IF( noexcept(_Alloc(__other)) ) + : _Alloc(__other) + { } + +#if __cplusplus >= 201103L + __alloc_value_initializer(_Alloc&& __other) + noexcept( noexcept(_Alloc(std::move(__other))) ) + : _Alloc(std::move(__other)) + { } +#endif + }; + + template + struct __alloc_value_initializer<_Alloc, false> : public _Alloc + { +#if __cplusplus >= 201103L + __alloc_value_initializer() = default; + + __alloc_value_initializer(_Alloc&& __other) + noexcept( noexcept(_Alloc(std::move(__other))) ) + : _Alloc(std::move(__other)) + { } +#else + __alloc_value_initializer() throw() + { } +#endif + + __alloc_value_initializer(const _Alloc& __other) + _GLIBCXX_NOEXCEPT_IF(noexcept(_Alloc(__other))) + : _Alloc(__other) + { } + }; + _GLIBCXX_END_NAMESPACE_VERSION } // namespace std