mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-13 09:20:25 +08:00
Improve correctness of convertion checks
This commit is contained in:
parent
2ce9a3f70f
commit
4ef4d0659d
@ -143,7 +143,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// T can be statically converted to string_view
|
// T can be statically converted to string_view
|
||||||
template<class T, typename std::enable_if<std::is_convertible<T, spdlog::string_view_t>::value, T>::type * = nullptr>
|
template<class T, typename std::enable_if<std::is_convertible<const T &, spdlog::string_view_t>::value, T>::type * = 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))
|
||||||
@ -156,7 +156,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// T cannot be statically converted to string_view
|
// T cannot be statically converted to string_view
|
||||||
template<class T, typename std::enable_if<!std::is_convertible<T, spdlog::string_view_t>::value, T>::type * = nullptr>
|
template<class T, typename std::enable_if<!std::is_convertible<const T &, spdlog::string_view_t>::value, T>::type * = 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))
|
||||||
@ -279,7 +279,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<std::is_convertible<T, spdlog::wstring_view_t>::value, T>::type * = nullptr>
|
template<class T, typename std::enable_if<std::is_convertible<const T &, spdlog::wstring_view_t>::value, T>::type * = 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…
Reference in New Issue
Block a user