Skip to content

Commit

Permalink
Dont force store_into to override default/explicit values if already set
Browse files Browse the repository at this point in the history
  • Loading branch information
orenc17 committed Sep 19, 2024
1 parent fd13c28 commit d40d2fc
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 d40d2fc

Please sign in to comment.