Skip to content

Commit

Permalink
Fixed latest build error in msvc platform (#3630)
Browse files Browse the repository at this point in the history
* Fixed latest build error in msvc platform

warnings in msvc about mix/max macro while windows.h is used in the project #762

* Update for CI

None

* Update single_include/nlohmann/json.hpp

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>

Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
  • Loading branch information
Lioncky and falbrechtskirchinger authored Jul 30, 2022
1 parent a2578d1 commit fc3e64c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions include/nlohmann/detail/meta/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ struct value_in_range_of_impl2<OfType, T, false, false>
static constexpr bool test(T val)
{
using CommonType = typename std::common_type<OfType, T>::type;
return static_cast<CommonType>(val) <= static_cast<CommonType>(std::numeric_limits<OfType>::max());
return static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());
}
};

Expand All @@ -629,7 +629,7 @@ struct value_in_range_of_impl2<OfType, T, true, false>
static constexpr bool test(T val)
{
using CommonType = typename std::common_type<OfType, T>::type;
return static_cast<CommonType>(val) <= static_cast<CommonType>(std::numeric_limits<OfType>::max());
return static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());
}
};

Expand All @@ -639,7 +639,7 @@ struct value_in_range_of_impl2<OfType, T, false, true>
static constexpr bool test(T val)
{
using CommonType = typename std::common_type<OfType, T>::type;
return val >= 0 && static_cast<CommonType>(val) <= static_cast<CommonType>(std::numeric_limits<OfType>::max());
return val >= 0 && static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());
}
};

Expand All @@ -650,8 +650,8 @@ struct value_in_range_of_impl2<OfType, T, true, true>
static constexpr bool test(T val)
{
using CommonType = typename std::common_type<OfType, T>::type;
return static_cast<CommonType>(val) >= static_cast<CommonType>(std::numeric_limits<OfType>::min())
&& static_cast<CommonType>(val) <= static_cast<CommonType>(std::numeric_limits<OfType>::max());
return static_cast<CommonType>(val) >= static_cast<CommonType>((std::numeric_limits<OfType>::min)())
&& static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());
}
};

Expand Down
10 changes: 5 additions & 5 deletions single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3977,7 +3977,7 @@ struct value_in_range_of_impl2<OfType, T, false, false>
static constexpr bool test(T val)
{
using CommonType = typename std::common_type<OfType, T>::type;
return static_cast<CommonType>(val) <= static_cast<CommonType>(std::numeric_limits<OfType>::max());
return static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());
}
};

Expand All @@ -3987,7 +3987,7 @@ struct value_in_range_of_impl2<OfType, T, true, false>
static constexpr bool test(T val)
{
using CommonType = typename std::common_type<OfType, T>::type;
return static_cast<CommonType>(val) <= static_cast<CommonType>(std::numeric_limits<OfType>::max());
return static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());
}
};

Expand All @@ -3997,7 +3997,7 @@ struct value_in_range_of_impl2<OfType, T, false, true>
static constexpr bool test(T val)
{
using CommonType = typename std::common_type<OfType, T>::type;
return val >= 0 && static_cast<CommonType>(val) <= static_cast<CommonType>(std::numeric_limits<OfType>::max());
return val >= 0 && static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());
}
};

Expand All @@ -4008,8 +4008,8 @@ struct value_in_range_of_impl2<OfType, T, true, true>
static constexpr bool test(T val)
{
using CommonType = typename std::common_type<OfType, T>::type;
return static_cast<CommonType>(val) >= static_cast<CommonType>(std::numeric_limits<OfType>::min())
&& static_cast<CommonType>(val) <= static_cast<CommonType>(std::numeric_limits<OfType>::max());
return static_cast<CommonType>(val) >= static_cast<CommonType>((std::numeric_limits<OfType>::min)())
&& static_cast<CommonType>(val) <= static_cast<CommonType>((std::numeric_limits<OfType>::max)());
}
};

Expand Down

0 comments on commit fc3e64c

Please sign in to comment.