Skip to content

Commit

Permalink
fix bug 385
Browse files Browse the repository at this point in the history
  • Loading branch information
geon6 committed Nov 27, 2024
1 parent cbd9fd8 commit 8bacffd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions include/argparse/argparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,10 @@ class Argument {
if (m_default_value.has_value()) {
var = std::any_cast<bool>(m_default_value);
}
action([&var](const auto & /*unused*/) { var = true; });
action([&var](const auto & /*unused*/) {
var = true;
return var;
});
return *this;
}

Expand All @@ -708,6 +711,7 @@ class Argument {
}
action([&var](const auto &s) {
var = details::parse_number<T, details::radix_10>()(s);
return var;
});
return *this;
}
Expand All @@ -718,6 +722,7 @@ class Argument {
}
action([&var](const auto &s) {
var = details::parse_number<double, details::chars_format::general>()(s);
return var;
});
return *this;
}
Expand All @@ -726,7 +731,10 @@ class Argument {
if (m_default_value.has_value()) {
var = std::any_cast<std::string>(m_default_value);
}
action([&var](const std::string &s) { var = s; });
action([&var](const std::string &s) {
var = s;
return var;
});
return *this;
}

Expand All @@ -740,6 +748,7 @@ class Argument {
}
m_is_used = true;
var.push_back(s);
return var;
});
return *this;
}
Expand All @@ -754,6 +763,7 @@ class Argument {
}
m_is_used = true;
var.push_back(details::parse_number<int, details::radix_10>()(s));
return var;
});
return *this;
}
Expand All @@ -768,6 +778,7 @@ class Argument {
}
m_is_used = true;
var.insert(s);
return var;
});
return *this;
}
Expand All @@ -782,6 +793,7 @@ class Argument {
}
m_is_used = true;
var.insert(details::parse_number<int, details::radix_10>()(s));
return var;
});
return *this;
}
Expand Down

0 comments on commit 8bacffd

Please sign in to comment.