Index: libcxx/include/memory =================================================================== --- libcxx/include/memory +++ libcxx/include/memory @@ -395,6 +395,10 @@ template unique_ptr make_unique(size_t n); // C++14 template unspecified make_unique(Args&&...) = delete; // C++14, T == U[N] +template unique_ptr make_unique_for_overwrite(); // C++20, T not an array +template unique_ptr make_unique_for_overwrite(size_t n); // C++20, T == U[] +template unspecified make_unique_for_overwrite(Args&&...) = delete; // C++20, T == U[N] + template basic_ostream& operator<< (basic_ostream& os, unique_ptr const& p); @@ -2074,6 +2078,31 @@ #endif // _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER > 20 + +template +inline _LIBCPP_INLINE_VISIBILITY +typename __unique_if<_Tp>::__unique_single +make_unique_for_overwrite() +{ + return unique_ptr<_Tp>(new _Tp);; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +typename __unique_if<_Tp>::__unique_array_unknown_bound +make_unique_for_overwrite(size_t __n) +{ + typedef typename remove_extent<_Tp>::type _Up; + return unique_ptr<_Tp>(new _Up[__n]); +} + +template + typename __unique_if<_Tp>::__unique_array_known_bound + make_unique_for_overwrite(_Args&&...) = delete; + +#endif // _LIBCPP_STD_VER > 11 + template #ifdef _LIBCPP_CXX03_LANG struct _LIBCPP_TEMPLATE_VIS hash >