From cbc7d9ec38d0e0b7f7f8844007acbd3c368faa94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=92=E6=95=85=E9=87=8C?= <3326284481@qq.com> Date: Thu, 11 Apr 2024 18:53:01 +0800 Subject: [PATCH 1/3] Remove meaningless std::move.Optimized string concatenation. --- stl/inc/chrono | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/chrono b/stl/inc/chrono index 3a94bdeca66..f347ade84a7 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -2176,7 +2176,7 @@ namespace chrono { _NODISCARD inline string _Tzdb_update_version(const string_view _Version, const size_t _Num_leap_seconds) { string _Icu_version{_Version.substr(0, _Version.find_last_of('.'))}; - return _STD move(_Icu_version) + "." + _STD to_string(_Num_leap_seconds); + return (_Icu_version += '.') += _STD to_string(_Num_leap_seconds); } struct _Secret_tzdb_list_construct_tag { From ba05445408843522c728ee06015d39c75e46100f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BD=92=E6=95=85=E9=87=8C?= <3326284481@qq.com> Date: Thu, 11 Apr 2024 21:24:09 +0800 Subject: [PATCH 2/3] Modify the return problem --- stl/inc/chrono | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stl/inc/chrono b/stl/inc/chrono index f347ade84a7..41b412fa421 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -2176,7 +2176,8 @@ namespace chrono { _NODISCARD inline string _Tzdb_update_version(const string_view _Version, const size_t _Num_leap_seconds) { string _Icu_version{_Version.substr(0, _Version.find_last_of('.'))}; - return (_Icu_version += '.') += _STD to_string(_Num_leap_seconds); + (_Icu_version += '.') += _STD to_string(_Num_leap_seconds); + return _Icu_version; } struct _Secret_tzdb_list_construct_tag { From 737bba9574800206ce4f53dede864496f7385bc0 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 11 Apr 2024 12:13:41 -0700 Subject: [PATCH 3/3] Use separate statements for concatenation. --- stl/inc/chrono | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stl/inc/chrono b/stl/inc/chrono index 41b412fa421..58c711194a5 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -2176,7 +2176,8 @@ namespace chrono { _NODISCARD inline string _Tzdb_update_version(const string_view _Version, const size_t _Num_leap_seconds) { string _Icu_version{_Version.substr(0, _Version.find_last_of('.'))}; - (_Icu_version += '.') += _STD to_string(_Num_leap_seconds); + _Icu_version += '.'; + _Icu_version += _STD to_string(_Num_leap_seconds); return _Icu_version; }