Replace fmt_helper::to_string by a macro

This commit is contained in:
Charles Milette
2022-04-26 23:25:35 -04:00
parent 37dd6bb159
commit cd4f6c1466
4 changed files with 12 additions and 13 deletions

View File

@@ -145,7 +145,7 @@ using wmemory_buf_t = std::wstring;
template<typename... Args>
using wformat_string_t = std::wstring_view;
# endif
# define SPDLOG_BUF_TO_STRING(x) x
#else // use fmt lib instead of std::format
namespace fmt_lib = fmt;
@@ -173,6 +173,7 @@ using wmemory_buf_t = fmt::basic_memory_buffer<wchar_t, 250>;
template<typename... Args>
using wformat_string_t = fmt::wformat_string<Args...>;
# endif
# define SPDLOG_BUF_TO_STRING(x) fmt::to_string(x)
#endif
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
@@ -323,7 +324,7 @@ template<bool B, class T = void>
using enable_if_t = typename std::enable_if<B, T>::type;
template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args &&... args)
std::unique_ptr<T> make_unique(Args &&...args)
{
static_assert(!std::is_array<T>::value, "arrays not supported");
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));

View File

@@ -33,7 +33,6 @@
# if defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT) || defined(SPDLOG_WCHAR_FILENAMES)
# include <limits>
# include <spdlog/details/fmt_helper.h>
# endif
# include <direct.h> // for _mkdir/_wmkdir
@@ -389,7 +388,7 @@ SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)
{
memory_buf_t buf;
wstr_to_utf8buf(filename, buf);
return fmt_helper::to_string(std::move(buf));
return SPDLOG_BUF_TO_STRING(buf);
}
#else
SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)

View File

@@ -5,7 +5,6 @@
#include "spdlog/sinks/base_sink.h"
#include "spdlog/details/circular_q.h"
#include "spdlog/details/fmt_helper.h"
#include "spdlog/details/log_msg_buffer.h"
#include "spdlog/details/null_mutex.h"
@@ -51,7 +50,7 @@ public:
{
memory_buf_t formatted;
base_sink<Mutex>::formatter_->format(q_.at(i), formatted);
ret.push_back(details::fmt_helper::to_string(std::move(formatted)));
ret.push_back(SPDLOG_BUF_TO_STRING(std::move(formatted)));
}
return ret;
}