X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcore%2Fgetopt.h;h=a3b7ae405ec567c4d9b0fb6a8966d89bed4fb689;hp=ea1f7d36a33fcea90ba552e58cb8b7546e462f34;hb=736d15fbdee0ea47b38a4d5fcd321e86eb21b465;hpb=e4584bf621f6ef457a944c7604888b4132ad1706 diff --git a/source/core/getopt.h b/source/core/getopt.h index ea1f7d3..a3b7ae4 100644 --- a/source/core/getopt.h +++ b/source/core/getopt.h @@ -123,17 +123,19 @@ public: template OptBase &add_option(char s, const std::string &l, T &d, ArgType a = NO_ARG) - { opts.push_back(new Option(s, l, d, a)); return *opts.back(); } + { return add_option(new Option(s, l, d, a)); } template OptBase &add_option(char s, const std::string &l, std::list &d, ArgType a = REQUIRED_ARG) - { opts.push_back(new ListOption >(s, l, d, a)); return *opts.back(); } + { return add_option(new ListOption >(s, l, d, a)); } template OptBase &add_option(const std::string &l, T &d, ArgType a) { return add_option(0, l, d, a); } private: + OptBase &add_option(OptBase *); + OptBase &get_option(char); OptBase &get_option(const std::string &);