Skip to content

Commit

Permalink
Resolves the std::numeric_limits<std::size_t>::max)()} error
Browse files Browse the repository at this point in the history
similar to this one microsoft/cppwinrt#479
  • Loading branch information
NTR2024 committed Mar 17, 2023
1 parent e516556 commit 1c266d2
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions include/argparse/argparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,10 +506,10 @@ class Argument {
m_num_args_range = NArgsRange{0, 1};
break;
case nargs_pattern::any:
m_num_args_range = NArgsRange{0, std::numeric_limits<std::size_t>::max()};
m_num_args_range = NArgsRange{0, (std::numeric_limits<std::size_t>::max)()};
break;
case nargs_pattern::at_least_one:
m_num_args_range = NArgsRange{1, std::numeric_limits<std::size_t>::max()};
m_num_args_range = NArgsRange{1, (std::numeric_limits<std::size_t>::max)()};
break;
}
return *this;
Expand Down Expand Up @@ -733,7 +733,7 @@ class Argument {
bool is_exact() const { return m_min == m_max; }

bool is_right_bounded() const {
return m_max < std::numeric_limits<std::size_t>::max();
return m_max < (std::numeric_limits<std::size_t>::max)();
}

std::size_t get_min() const { return m_min; }
Expand All @@ -748,7 +748,7 @@ class Argument {
stream << "[nargs: " << range.m_min << "] ";
}
} else {
if (range.m_max == std::numeric_limits<std::size_t>::max()) {
if (range.m_max == (std::numeric_limits<std::size_t>::max)()) {
stream << "[nargs: " << range.m_min << " or more] ";
} else {
stream << "[nargs=" << range.m_min << ".." << range.m_max << "] ";
Expand Down Expand Up @@ -1654,10 +1654,10 @@ class ArgumentParser {
}
std::size_t max_size = 0;
for ([[maybe_unused]] const auto &[unused, argument] : m_argument_map) {
max_size = std::max(max_size, argument->get_arguments_length());
max_size = std::max<std::size_t>(max_size, argument->get_arguments_length());
}
for ([[maybe_unused]] const auto &[command, unused] : m_subparser_map) {
max_size = std::max(max_size, command.size());
max_size = std::max<std::size_t>(max_size, command.size());
}
return max_size;
}
Expand Down

0 comments on commit 1c266d2

Please sign in to comment.