diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 620b4757..d391b11b 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -321,24 +321,15 @@ struct file_event_handlers namespace details { -// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324) -template::value, int> = 0> -constexpr T conditional_static_cast(U value) -{ - return static_cast(value); -} - -template::value, int> = 0> -constexpr T conditional_static_cast(U value) -{ - return value; -} - // make_unique support for pre c++14 #if __cplusplus >= 201402L // C++14 and beyond +using std::enable_if_t; using std::make_unique; #else +template +using enable_if_t = typename std::enable_if::type; + template std::unique_ptr make_unique(Args &&...args) { @@ -346,6 +337,20 @@ std::unique_ptr make_unique(Args &&...args) return std::unique_ptr(new T(std::forward(args)...)); } #endif + +// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324) +template::value, int> = 0> +constexpr T conditional_static_cast(U value) +{ + return static_cast(value); +} + +template::value, int> = 0> +constexpr T conditional_static_cast(U value) +{ + return value; +} + } // namespace details } // namespace spdlog