]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/getopt.cpp
Add move semantics to Variant
[libs/core.git] / source / core / getopt.cpp
index ec821e0d26aea1372c3314cc8a1a99a268d5443e..cbc0afb0d76e9d5eec8f79e4a835d1cf01ff7700 100644 (file)
@@ -6,8 +6,7 @@ using namespace std;
 
 namespace Msp {
 
-GetOpt::GetOpt():
-       help(false)
+GetOpt::GetOpt()
 {
        add_option("help", help, NO_ARG).set_help("Displays this help");
 }
@@ -32,7 +31,7 @@ GetOpt::OptionImpl &GetOpt::add_option(char s, const string &l, const Store &t,
                if((s!=0 && (*i)->get_short()==s) || (*i)->get_long()==l)
                {
                        delete *i;
-                       opts.erase(i++);
+                       i = opts.erase(i);
                }
                else
                        ++i;
@@ -260,7 +259,7 @@ string GetOpt::generate_help() const
        bool any_short = any_of(opts.begin(), opts.end(), [](const OptionImpl *o){ return o->get_short(); });
 
        string::size_type maxw = 0;
-       list<string> switches;
+       vector<string> switches;
        for(const OptionImpl *o: opts)
        {
                string swtch;
@@ -289,7 +288,7 @@ string GetOpt::generate_help() const
                maxw = max(maxw, swtch.size());
        }
 
-       list<string> pargs;
+       vector<string> pargs;
        for(const ArgumentImpl *a: args)
        {
                string parg = format("<%s>", a->get_name());
@@ -318,9 +317,6 @@ GetOpt::OptionImpl::OptionImpl(char s, const string &l, const Store &t, ArgType
        shrt(s),
        lng(l),
        arg_type(a),
-       seen_count(0),
-       ext_seen_count(0),
-       metavar("ARG"),
        store(t.clone())
 { }