From 97c7e066fbc5c29097ae2c1417f02c5cbf639e6e Mon Sep 17 00:00:00 2001 From: Roman Koshelev Date: Tue, 31 Aug 2021 07:51:06 +0300 Subject: [PATCH] Fix copy_str performance --- include/fmt/core.h | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/include/fmt/core.h b/include/fmt/core.h index 2f0cfb0b..d81af846 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -742,18 +742,7 @@ inline auto get_container(std::back_insert_iterator it) template FMT_CONSTEXPR auto copy_str(InputIt begin, InputIt end, OutputIt out) -> OutputIt { - while (begin != end) *out++ = static_cast(*begin++); - return out; -} - -template ::value)> -FMT_CONSTEXPR auto copy_str(const Char* begin, const Char* end, Char* out) - -> Char* { - if (is_constant_evaluated()) - return copy_str(begin, end, out); - auto size = to_unsigned(end - begin); - memcpy(out, begin, size); - return out + size; + return std::copy(begin, end, out); } /**