@@ -407,6 +407,24 @@ template<class charT, class traits, class Allocator>
407407basic_string<charT, traits, Allocator>
408408operator+(const basic_string<charT, traits, Allocator>& lhs, charT rhs); // constexpr since C++20
409409
410+ template<class charT, class traits, class Allocator>
411+ constexpr basic_string<charT, traits, Allocator>
412+ operator+(const basic_string<charT, traits, Allocator>& lhs,
413+ type_identity_t<basic_string_view<charT, traits>> rhs); // Since C++26
414+ template<class charT, class traits, class Allocator>
415+ constexpr basic_string<charT, traits, Allocator>
416+ operator+(basic_string<charT, traits, Allocator>&& lhs,
417+ type_identity_t<basic_string_view<charT, traits>> rhs); // Since C++26
418+ template<class charT, class traits, class Allocator>
419+ constexpr basic_string<charT, traits, Allocator>
420+ operator+(type_identity_t<basic_string_view<charT, traits>> lhs,
421+ const basic_string<charT, traits, Allocator>& rhs); // Since C++26
422+ template<class charT, class traits, class Allocator>
423+ constexpr basic_string<charT, traits, Allocator>
424+ operator+(type_identity_t<basic_string_view<charT, traits>> lhs,
425+ basic_string<charT, traits, Allocator>&& rhs); // Since C++26
426+
427+
410428template<class charT, class traits, class Allocator>
411429bool operator==(const basic_string<charT, traits, Allocator>& lhs,
412430 const basic_string<charT, traits, Allocator>& rhs) noexcept; // constexpr since C++20
@@ -687,6 +705,28 @@ template <class _CharT, class _Traits, class _Allocator>
687705_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>
688706operator +(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
689707
708+ #if _LIBCPP_STD_VER >= 26
709+
710+ template <class _CharT , class _Traits , class _Allocator >
711+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator>
712+ operator +(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
713+ type_identity_t <basic_string_view<_CharT, _Traits>> __rhs);
714+
715+ template <class _CharT , class _Traits , class _Allocator >
716+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator>
717+ operator +(basic_string<_CharT, _Traits, _Allocator>&& __lhs, type_identity_t <basic_string_view<_CharT, _Traits>> __rhs);
718+
719+ template <class _CharT , class _Traits , class _Allocator >
720+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator>
721+ operator +(type_identity_t <basic_string_view<_CharT, _Traits>> __lhs,
722+ const basic_string<_CharT, _Traits, _Allocator>& __rhs);
723+
724+ template <class _CharT , class _Traits , class _Allocator >
725+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator>
726+ operator +(type_identity_t <basic_string_view<_CharT, _Traits>> __lhs, basic_string<_CharT, _Traits, _Allocator>&& __rhs);
727+
728+ #endif
729+
690730extern template _LIBCPP_EXPORTED_FROM_ABI string operator +
691731 <char , char_traits<char >, allocator<char > >(char const *, string const &);
692732
@@ -2150,6 +2190,10 @@ private:
21502190 friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator + <>(value_type, const basic_string&);
21512191 friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator + <>(const basic_string&, const value_type*);
21522192 friend _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string operator + <>(const basic_string&, value_type);
2193+ #if _LIBCPP_STD_VER >= 26
2194+ friend constexpr basic_string operator + <>(const basic_string&, type_identity_t <__self_view>);
2195+ friend constexpr basic_string operator + <>(type_identity_t <__self_view>, const basic_string&);
2196+ #endif
21532197};
21542198
21552199// These declarations must appear before any functions are implicitly used
@@ -4007,6 +4051,60 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs) {
40074051
40084052#endif // _LIBCPP_CXX03_LANG
40094053
4054+ #if _LIBCPP_STD_VER >= 26
4055+
4056+ template <class _CharT , class _Traits , class _Allocator >
4057+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator>
4058+ operator +(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
4059+ type_identity_t <basic_string_view<_CharT, _Traits>> __rhs) {
4060+ using _String = basic_string<_CharT, _Traits, _Allocator>;
4061+ typename _String::size_type __lhs_sz = __lhs.size ();
4062+ typename _String::size_type __rhs_sz = __rhs.size ();
4063+ _String __r (__uninitialized_size_tag (),
4064+ __lhs_sz + __rhs_sz,
4065+ _String::__alloc_traits::select_on_container_copy_construction (__lhs.get_allocator ()));
4066+ auto __ptr = std::__to_address (__r.__get_pointer ());
4067+ _Traits::copy (__ptr, __lhs.data (), __lhs_sz);
4068+ _Traits::copy (__ptr + __lhs_sz, __rhs.data (), __rhs_sz);
4069+ _Traits::assign (__ptr + __lhs_sz + __rhs_sz, 1 , _CharT ());
4070+ return __r;
4071+ }
4072+
4073+ template <class _CharT , class _Traits , class _Allocator >
4074+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator>
4075+ operator +(basic_string<_CharT, _Traits, _Allocator>&& __lhs,
4076+ type_identity_t <basic_string_view<_CharT, _Traits>> __rhs) {
4077+ __lhs.append (__rhs);
4078+ return std::move (__lhs);
4079+ }
4080+
4081+ template <class _CharT , class _Traits , class _Allocator >
4082+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator>
4083+ operator +(type_identity_t <basic_string_view<_CharT, _Traits>> __lhs,
4084+ const basic_string<_CharT, _Traits, _Allocator>& __rhs) {
4085+ using _String = basic_string<_CharT, _Traits, _Allocator>;
4086+ typename _String::size_type __lhs_sz = __lhs.size ();
4087+ typename _String::size_type __rhs_sz = __rhs.size ();
4088+ _String __r (__uninitialized_size_tag (),
4089+ __lhs_sz + __rhs_sz,
4090+ _String::__alloc_traits::select_on_container_copy_construction (__rhs.get_allocator ()));
4091+ auto __ptr = std::__to_address (__r.__get_pointer ());
4092+ _Traits::copy (__ptr, __lhs.data (), __lhs_sz);
4093+ _Traits::copy (__ptr + __lhs_sz, __rhs.data (), __rhs_sz);
4094+ _Traits::assign (__ptr + __lhs_sz + __rhs_sz, 1 , _CharT ());
4095+ return __r;
4096+ }
4097+
4098+ template <class _CharT , class _Traits , class _Allocator >
4099+ _LIBCPP_HIDE_FROM_ABI constexpr basic_string<_CharT, _Traits, _Allocator>
4100+ operator +(type_identity_t <basic_string_view<_CharT, _Traits>> __lhs,
4101+ basic_string<_CharT, _Traits, _Allocator>&& __rhs) {
4102+ __rhs.insert (0 , __lhs);
4103+ return std::move (__rhs);
4104+ }
4105+
4106+ #endif // _LIBCPP_STD_VER >= 26
4107+
40104108// swap
40114109
40124110template <class _CharT , class _Traits , class _Allocator >
0 commit comments