Skip to content

Commit

Permalink
Merge pull request #380 from orenc17/fix-store_into-overload
Browse files Browse the repository at this point in the history
Dont force store_into to override default/explicit values if already set
  • Loading branch information
p-ranav authored Sep 20, 2024
2 parents fd13c28 + d40d2fc commit e709046
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/argparse/argparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,9 @@ class Argument {
}

auto &store_into(bool &var) {
flag();
if ((!m_default_value.has_value()) && (!m_implicit_value.has_value())) {
flag();
}
if (m_default_value.has_value()) {
var = std::any_cast<bool>(m_default_value);
}
Expand Down

0 comments on commit e709046

Please sign in to comment.