fix: ‘fmt’ was not declared

This commit is contained in:
mutouyun 2022-11-28 22:32:39 +08:00
parent 7ba65c6f18
commit 9c331ba03d
2 changed files with 12 additions and 17 deletions

View File

@ -111,5 +111,17 @@ auto tag_invoke(fmt_to_string_t, fmt_ref<T> arg) noexcept
return ::LIBIMP::to_string(static_cast<T>(arg.param), arg.fstr);
}
template <typename T>
std::string tag_invoke(decltype(::LIBIMP::fmt_to_string), span<T> 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_

View File

@ -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 <span>
@ -267,20 +266,4 @@ inline auto make_span(std::string const &str) noexcept -> span<char const> {
return {str.data(), str.size()};
}
/// @brief Custom defined fmt_to_string method for imp::fmt
namespace detail {
template <typename T>
std::string tag_invoke(decltype(::LIBIMP::fmt_to_string), span<T> 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_