+ bool help;
+ std::list<OptBase *> opts;
+ std::vector<std::string> args;
+
+public:
+ GetOpt();
+ ~GetOpt();
+
+ /// Returns any non-option arguments encountered during processing.
+ const std::vector<std::string> &get_args() const { return args; }
+
+ /** Adds an option with both short and long forms. Processing depends on
+ the type of the destination variable and whether an argument is taken or
+ not. With an argument, the value is lexical_cast to appropriate type and
+ stored in the destination. Without an argument, a bool will be set to true
+ and an unsigned will be incremented; any other type will be ignored. */
+ template<typename T>
+ Option &add_option(char s, const std::string &l, T &d, ArgType a = NO_ARG)
+ { return add_option(new SimpleOption<T>(s, l, d, a)); }
+
+ /** Adds an option with both short and long forms. The option may be
+ specified multiple times, and the argument from each occurrence is stored in
+ the list. The argument type must be REQUIRED_ARG. */
+ template<typename T>
+ Option &add_option(char s, const std::string &l, std::list<T> &d, ArgType a = REQUIRED_ARG)
+ { return add_option(new ListOption<std::list<T> >(s, l, d, a)); }
+
+ /** Adds an option with only a long form. */
+ template<typename T>
+ Option &add_option(const std::string &l, T &d, ArgType a)
+ { return add_option(0, l, d, a); }
+
+private:
+ OptBase &add_option(OptBase *);