From 96c92118d31b6c8d7046ff32c97eb519fb5e08d1 Mon Sep 17 00:00:00 2001 From: vspefs Date: Wed, 12 Feb 2025 22:07:50 +0800 Subject: [PATCH 1/3] Add a conditional compilation directive to be compatible with C++26 --- source/common.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/common.h b/source/common.h index 8fceff695..926e59d82 100644 --- a/source/common.h +++ b/source/common.h @@ -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 [[nodiscard]] constexpr auto operator+( std::basic_string lhs, @@ -605,6 +604,7 @@ template { return rhs.insert(0, lhs); } +#endif //----------------------------------------------------------------------- From 04407a16d2d96dcd8d9e03787a306f94c86633cb Mon Sep 17 00:00:00 2001 From: vspefs Date: Thu, 13 Feb 2025 01:35:27 +0800 Subject: [PATCH 2/3] fix typo Signed-off-by: vspefs --- source/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/common.h b/source/common.h index 926e59d82..c3d4d084e 100644 --- a/source/common.h +++ b/source/common.h @@ -582,7 +582,7 @@ auto print_with_thousands(T val) // 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. +// now safely turn it on/off with FTM. // #if __cpp_lib_string_view < 202403L template From 88c8bbcf569322031375c2e1a4305269f8da7a7e Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Fri, 28 Feb 2025 18:10:48 -1000 Subject: [PATCH 3/3] Tweak comment before merging --- source/common.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/source/common.h b/source/common.h index c3d4d084e..912fcd866 100644 --- a/source/common.h +++ b/source/common.h @@ -580,10 +580,8 @@ auto print_with_thousands(T val) } -// 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 turn it on/off with FTM. -// +// Provide string+string_view if P2591 is not available. +// #if __cpp_lib_string_view < 202403L template [[nodiscard]] constexpr auto operator+(