]> git.tdb.fi Git - libs/core.git/blobdiff - source/core/getopt.h
Use a typedef for the option descriptor list
[libs/core.git] / source / core / getopt.h
index 2aaceef836730aa24a966c3cfaa20bb9864e23a7..4f53cc2ddcafd2b4fbabb19be9e4150120d9bb6d 100644 (file)
@@ -122,16 +122,7 @@ private:
                virtual void store() { }
 
                virtual void store(const std::string &a)
-               {
-                       try
-                       {
-                               data = lexical_cast<T>(a);
-                       }
-                       catch(const lexical_error &e)
-                       {
-                               throw usage_error("Invalid argument for --"+lng+" ("+e.what()+")");
-                       }
-               }
+               { data = lexical_cast<T>(a); }
        };
 
        template<typename T>
@@ -147,20 +138,13 @@ private:
                virtual void store() { }
 
                virtual void store(const std::string &a)
-               {
-                       try
-                       {
-                               data.push_back(lexical_cast<typename T::value_type>(a));
-                       }
-                       catch(const lexical_error &e)
-                       {
-                               throw usage_error("Invalid argument for --"+lng+" ("+e.what()+")");
-                       }
-               }
+               { data.push_back(lexical_cast<typename T::value_type>(a)); }
        };
 
+       typedef std::list<OptBase *> OptionList;
+
        bool help;
-       std::list<OptBase *> opts;
+       OptionList opts;
        std::vector<std::string> args;
 
 public: