Skip to content

Commit

Permalink
only optimize swap for std::alocator
Browse files Browse the repository at this point in the history
  • Loading branch information
cor3ntin committed Oct 9, 2024
1 parent a171402 commit af33fb7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libcxx/include/string
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ struct __init_with_sentinel_tag {};

template <class _CharT, class _Traits, class _Allocator>
class basic_string memberwise_trivially_relocatable
memberwise_replaceable {
memberwise_replaceable {

private:
using __default_allocator_type = allocator<_CharT>;
Expand Down Expand Up @@ -3449,7 +3449,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
{

#if _LIBCPP_STD_VER >= 26
if constexpr(__alloc_traits::is_always_equal::value) {
if constexpr(std::is_same_v<allocator_type, allocator<_CharT>>) {
std::swap_value_representations(*this, __str);
return;
}
Expand Down

0 comments on commit af33fb7

Please sign in to comment.