enable_if_t

pull/1884/head
gabime 5 years ago
parent 5a4b08ec91
commit 8f223961b0

@ -73,7 +73,7 @@ public:
void swap(spdlog::logger &other) noexcept; void swap(spdlog::logger &other) noexcept;
// FormatString is a type derived from fmt::compile_string // FormatString is a type derived from fmt::compile_string
template<typename FormatString, typename std::enable_if<fmt::is_compile_string<FormatString>::value, int>::type * = nullptr, template<typename FormatString, typename std::enable_if_t<fmt::is_compile_string<FormatString>::value, int> * = nullptr,
typename... Args> typename... Args>
void log(source_loc loc, level::level_enum lvl, const FormatString &fmt, const Args &... args) void log(source_loc loc, level::level_enum lvl, const FormatString &fmt, const Args &... args)
{ {
@ -136,9 +136,8 @@ public:
} }
// T can be statically converted to string_view and isn't a fmt::compile_string // T can be statically converted to string_view and isn't a fmt::compile_string
template<class T, template<class T, typename std::enable_if_t<
typename std::enable_if<std::is_convertible<const T &, spdlog::string_view_t>::value && !fmt::is_compile_string<T>::value, T>::type std::is_convertible<const T &, spdlog::string_view_t>::value && !fmt::is_compile_string<T>::value, T> * = nullptr>
* = nullptr>
void log(source_loc loc, level::level_enum lvl, const T &msg) void log(source_loc loc, level::level_enum lvl, const T &msg)
{ {
log(loc, lvl, string_view_t{msg}); log(loc, lvl, string_view_t{msg});
@ -172,9 +171,9 @@ public:
} }
// T cannot be statically converted to string_view or wstring_view // T cannot be statically converted to string_view or wstring_view
template<class T, typename std::enable_if<!std::is_convertible<const T &, spdlog::string_view_t>::value && template<class T, typename std::enable_if_t<!std::is_convertible<const T &, spdlog::string_view_t>::value &&
!is_convertible_to_wstring_view<const T &>::value, !is_convertible_to_wstring_view<const T &>::value,
T>::type * = nullptr> T> * = nullptr>
void log(source_loc loc, level::level_enum lvl, const T &msg) void log(source_loc loc, level::level_enum lvl, const T &msg)
{ {
log(loc, lvl, "{}", msg); log(loc, lvl, "{}", msg);
@ -243,7 +242,7 @@ public:
} }
// T can be statically converted to wstring_view // T can be statically converted to wstring_view
template<class T, typename std::enable_if<is_convertible_to_wstring_view<const T &>::value, T>::type * = nullptr> template<class T, typename std::enable_if_t<is_convertible_to_wstring_view<const T &>::value, T> * = nullptr>
void log(source_loc loc, level::level_enum lvl, const T &msg) void log(source_loc loc, level::level_enum lvl, const T &msg)
{ {
if (!should_log(lvl)) if (!should_log(lvl))

Loading…
Cancel
Save