diff options
author | Alexander Smirnov <alex@ydb.tech> | 2024-11-20 11:14:58 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2024-11-20 11:14:58 +0000 |
commit | 31773f157bf8164364649b5f470f52dece0a4317 (patch) | |
tree | 33d0f7eef45303ab68cf08ab381ce5e5e36c5240 /contrib/libs/cxxsupp/libcxx/include/sstream | |
parent | 2c7938962d8689e175574fc1e817c05049f27905 (diff) | |
parent | eff600952d5dfe17942f38f510a8ac2b203bb3a5 (diff) | |
download | ydb-31773f157bf8164364649b5f470f52dece0a4317.tar.gz |
Merge branch 'rightlib' into mergelibs-241120-1113
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/sstream')
-rw-r--r-- | contrib/libs/cxxsupp/libcxx/include/sstream | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/sstream b/contrib/libs/cxxsupp/libcxx/include/sstream index 40930df24c..4fec465d57 100644 --- a/contrib/libs/cxxsupp/libcxx/include/sstream +++ b/contrib/libs/cxxsupp/libcxx/include/sstream @@ -267,6 +267,7 @@ typedef basic_stringstream<wchar_t> wstringstream; */ #include <__assert> // all public C++ headers provide the assertion handler +#include <__availability> #include <__config> #include <__fwd/sstream.h> #include <__utility/swap.h> @@ -399,12 +400,12 @@ public: _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() const & { return str(__str_.get_allocator()); } _LIBCPP_HIDE_FROM_ABI_SSTREAM string_type str() && { - string_type __result; const basic_string_view<_CharT, _Traits> __view = view(); - if (!__view.empty()) { - auto __pos = __view.data() - __str_.data(); - __result.assign(std::move(__str_), __pos, __view.size()); - } + typename string_type::size_type __pos = __view.empty() ? 0 : __view.data() - __str_.data(); + // In C++23, this is just string_type(std::move(__str_), __pos, __view.size(), __str_.get_allocator()); + // But we need something that works in C++20 also. + string_type __result(__str_.get_allocator()); + __result.__move_assign(std::move(__str_), __pos, __view.size()); __str_.clear(); __init_buf_ptrs(); return __result; @@ -1192,7 +1193,7 @@ swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x, __x.swap(__y); } -#if defined(_LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1) +#ifndef _LIBCPP_AVAILABILITY_HAS_NO_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringbuf<char>; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringstream<char>; extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostringstream<char>; |