Skip to content

Commit

Permalink
Add a conditional compilation directive to be compatible with C++26
Browse files Browse the repository at this point in the history
  • Loading branch information
vspefs committed Feb 12, 2025
1 parent f864c74 commit 96c9211
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions source/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -580,12 +580,11 @@ auto print_with_thousands(T val)
}


// In keep trying to write string+string_view, and it ought to Just Work without
// the current workarounds. Not having that is a minor impediment to using safe
// and efficient string_views, which we should be encouraging. So for my own use
// and to remove that minor impediment to writing safe and efficient code, I'm
// just going to add this until we get P2591 in C++26(?) -- See: wg21.link/p2591
// In the past when we don't have standard string+string_view, we needed to
// manually implement it. However, since P2591 was adopted into C++26, we can
// now safely tune it on/off with FTM.
//
#if __cpp_lib_string_view < 202403L
template<class charT, class traits, class Allocator>
[[nodiscard]] constexpr auto operator+(
std::basic_string<charT, traits, Allocator> lhs,
Expand All @@ -605,6 +604,7 @@ template<class charT, class traits, class Allocator>
{
return rhs.insert(0, lhs);
}
#endif


//-----------------------------------------------------------------------
Expand Down

0 comments on commit 96c9211

Please sign in to comment.