Skip to content

Commit

Permalink
Fix default values for options
Browse files Browse the repository at this point in the history
  • Loading branch information
sisakat authored Aug 23, 2023
1 parent e497901 commit 6162e0a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/clapp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ SOFTWARE.
#include <vector>

#define CLAPP_VERSION_MAJOR 1
#define CLAPP_VERSION_MINOR 2
#define CLAPP_VERSION_MINOR 3
#define CLAPP_VERSION_PATCH 0

namespace clapp
Expand Down Expand Up @@ -214,6 +214,7 @@ class ArgumentParser
OptionWrapper<T>& store(T& store)
{
m_ref = &store;
*m_ref = m_value;
return *this;
}

Expand Down Expand Up @@ -249,6 +250,10 @@ class ArgumentParser
Option::set = true;
Option::has_default_value = true;
m_value = value;
if (m_ref != nullptr)
{
*m_ref = m_value;
}
return *this;
}

Expand Down Expand Up @@ -779,4 +784,4 @@ class ArgumentParser
return false;
}
};
} // namespace clapp
} // namespace clapp

0 comments on commit 6162e0a

Please sign in to comment.