Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Apr 21, 2024
1 parent dafbca8 commit af817f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitpicker.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{
"user": "p-ranav",
"repo": "argparse",
"branch": "9550b0a88c85120a0bf456af935eed2956c73340",
"branch": "ac4c2c2d96c974c6a4e487f288bfc89e108b64b1",
"root": "include/argparse",
"file": [
"argparse.hpp"
Expand Down
7 changes: 4 additions & 3 deletions argparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,12 +698,13 @@ class Argument {
return *this;
}

auto &store_into(int &var) {
template <typename T, typename std::enable_if<std::is_integral<T>::value>::type * = nullptr>
auto &store_into(T &var) {
if (m_default_value.has_value()) {
var = std::any_cast<int>(m_default_value);
var = std::any_cast<T>(m_default_value);
}
action([&var](const auto &s) {
var = details::parse_number<int, details::radix_10>()(s);
var = details::parse_number<T, details::radix_10>()(s);
});
return *this;
}
Expand Down

0 comments on commit af817f3

Please sign in to comment.