summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlocke <cgloeckner@freenet.de>2017-05-14 13:37:25 +0200
committerGitHub <noreply@github.com>2017-05-14 13:37:25 +0200
commite80cb2e1326fc17dea162d0b34b473e6ba218f74 (patch)
tree94af9b34d3a0dd88e79396bf2feecedd782a8f1f
parent607f05ab3bd8ef9b7625165fd916594edc19d06b (diff)
Update getoptpp.hpp
added comment for Options::add
-rw-r--r--getoptpp.hpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/getoptpp.hpp b/getoptpp.hpp
index 0eafe3f..1557206 100644
--- a/getoptpp.hpp
+++ b/getoptpp.hpp
@@ -49,8 +49,10 @@ void Options::add(std::string const & name, int has_arg, int val, Handle handle)
}
void Options::add(std::string const & name, int has_arg, int* flag, int val, Handle handle) {
- int index = val; // let val be the option's unique identifier
+ // create a new option from the args
options.push_back({name.data(), has_arg, flag, val});
+
+ int index = val; // let val be the option's unique identifier
if (flag != nullptr) {
// flag is not null, so the val is not used as identifier
// so pick another one