🚨 fix useless-cast warnings

parent 7feb2c20
......@@ -437,13 +437,13 @@ template<typename T1, typename... Args>
struct is_constructible_tuple<T1, std::tuple<Args...>> : conjunction<is_constructible<T1, Args>...> {};
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)
template < typename T, typename U, std::enable_if_t < !std::is_same<T, U>::value, int > = 0 >
template < typename T, typename U, enable_if_t < !std::is_same<T, U>::value, int > = 0 >
T conditional_static_cast(U value)
{
return static_cast<T>(value);
}
template<typename T, typename U, std::enable_if_t<std::is_same<T, U>::value, int> = 0>
template<typename T, typename U, enable_if_t<std::is_same<T, U>::value, int> = 0>
T conditional_static_cast(U value)
{
return value;
......
......@@ -3837,13 +3837,13 @@ template<typename T1, typename... Args>
struct is_constructible_tuple<T1, std::tuple<Args...>> : conjunction<is_constructible<T1, Args>...> {};
// to avoid useless casts (see https://github.com/nlohmann/json/issues/2893#issuecomment-889152324)
template < typename T, typename U, std::enable_if_t < !std::is_same<T, U>::value, int > = 0 >
template < typename T, typename U, enable_if_t < !std::is_same<T, U>::value, int > = 0 >
T conditional_static_cast(U value)
{
return static_cast<T>(value);
}
template<typename T, typename U, std::enable_if_t<std::is_same<T, U>::value, int> = 0>
template<typename T, typename U, enable_if_t<std::is_same<T, U>::value, int> = 0>
T conditional_static_cast(U value)
{
return value;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment