From ac094b6666b1e700e13d4f073350c9662ebb4f3d Mon Sep 17 00:00:00 2001 From: shuax Date: Wed, 19 Dec 2018 13:56:54 +0800 Subject: [PATCH] fix min/max defined macros --- include/cxxopts.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 6677002..1db7941 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -485,14 +485,14 @@ namespace cxxopts { if (negative) { - if (u > static_cast(-std::numeric_limits::min())) + if (u > static_cast(-(std::numeric_limits::min)())) { throw argument_incorrect_type(text); } } else { - if (u > static_cast(std::numeric_limits::max())) + if (u > static_cast((std::numeric_limits::max)())) { throw argument_incorrect_type(text); } @@ -553,7 +553,7 @@ namespace cxxopts using US = typename std::make_unsigned::type; - constexpr auto umax = std::numeric_limits::max(); + constexpr auto umax = (std::numeric_limits::max)(); constexpr bool is_signed = std::numeric_limits::is_signed; const bool negative = match.length(1) > 0; const uint8_t base = match.length(2) > 0 ? 16 : 10; @@ -1945,11 +1945,11 @@ Options::help_one_group(const std::string& g) const } auto s = format_option(o); - longest = std::max(longest, stringLength(s)); + longest = (std::max)(longest, stringLength(s)); format.push_back(std::make_pair(s, String())); } - longest = std::min(longest, static_cast(OPTION_LONGEST)); + longest = (std::min)(longest, static_cast(OPTION_LONGEST)); //widest allowed description auto allowed = size_t{76} - longest - OPTION_DESC_GAP;