From 9c331ba03d3a489b1bf8bbd256578247ee714dbc Mon Sep 17 00:00:00 2001 From: mutouyun Date: Mon, 28 Nov 2022 22:32:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E2=80=98fmt=E2=80=99=20was=20not=20decl?= =?UTF-8?q?ared?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/libimp/fmt.h | 12 ++++++++++++ include/libimp/span.h | 17 ----------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/include/libimp/fmt.h b/include/libimp/fmt.h index b76f715..67f32cc 100644 --- a/include/libimp/fmt.h +++ b/include/libimp/fmt.h @@ -111,5 +111,17 @@ auto tag_invoke(fmt_to_string_t, fmt_ref arg) noexcept return ::LIBIMP::to_string(static_cast(arg.param), arg.fstr); } +template +std::string tag_invoke(decltype(::LIBIMP::fmt_to_string), span s) { + if (s.empty()) { + return {}; + } + auto appender = fmt(s[0]); + for (std::size_t i = 1; i < s.size(); ++i) { + appender += fmt(' ', s[i]); + } + return appender; +} + } // namespace detail LIBIMP_NAMESPACE_END_ diff --git a/include/libimp/span.h b/include/libimp/span.h index ec88c37..fd25f49 100644 --- a/include/libimp/span.h +++ b/include/libimp/span.h @@ -19,7 +19,6 @@ #include "libimp/def.h" #include "libimp/detect_plat.h" -#include "libimp/fmt_cpo.h" #if defined(LIBIMP_CPP_20) && defined(__cpp_lib_span) #include @@ -267,20 +266,4 @@ inline auto make_span(std::string const &str) noexcept -> span { return {str.data(), str.size()}; } -/// @brief Custom defined fmt_to_string method for imp::fmt -namespace detail { - -template -std::string tag_invoke(decltype(::LIBIMP::fmt_to_string), span s) { - if (s.empty()) { - return {}; - } - auto appender = fmt(s[0]); - for (std::size_t i = 1; i < s.size(); ++i) { - appender += fmt(' ', s[i]); - } - return appender; -} - -} // namespace detail LIBIMP_NAMESPACE_END_