diff -r 0ffc78641b34 -r fb2052c94ebd lemon/arg_parser.h --- a/lemon/arg_parser.h Tue Mar 13 12:33:40 2007 +0000 +++ b/lemon/arg_parser.h Tue Mar 13 15:35:56 2007 +0000 @@ -310,37 +310,41 @@ operator bool() { Opts::iterator i = _parser._opts.find(_name); - if(i==_parser._opts.end()) throw LogicError(); - else if(i->second.type!=ArgParser::BOOL) - throw LogicError(); - else return *(i->second.bool_p); + LEMON_ASSERT(i==_parser._opts.end(), + std::string()+"Unkown option: '"+_name+"'"); + LEMON_ASSERT(i->second.type!=ArgParser::BOOL, + std::string()+"'"+_name+"' is a bool option"); + return *(i->second.bool_p); } ///\e operator std::string() { Opts::iterator i = _parser._opts.find(_name); - if(i==_parser._opts.end()) throw LogicError(); - else if(i->second.type!=ArgParser::STRING) - throw LogicError(); - else return *(i->second.string_p); + LEMON_ASSERT(i==_parser._opts.end(), + std::string()+"Unkown option: '"+_name+"'"); + LEMON_ASSERT(i->second.type!=ArgParser::STRING, + std::string()+"'"+_name+"' is a string option"); + return *(i->second.string_p); } ///\e operator double() { Opts::iterator i = _parser._opts.find(_name); - if(i==_parser._opts.end()) throw LogicError(); - else if(i->second.type!=ArgParser::DOUBLE) - throw LogicError(); - else return *(i->second.double_p); + LEMON_ASSERT(i==_parser._opts.end(), + std::string()+"Unkown option: '"+_name+"'"); + LEMON_ASSERT(i->second.type!=ArgParser::DOUBLE, + std::string()+"'"+_name+"' is a floating point option"); + return *(i->second.double_p); } ///\e operator int() { Opts::iterator i = _parser._opts.find(_name); - if(i==_parser._opts.end()) throw LogicError(); - else if(i->second.type!=ArgParser::INTEGER) - throw LogicError(); - else return *(i->second.int_p); + LEMON_ASSERT(i==_parser._opts.end(), + std::string()+"Unkown option: '"+_name+"'"); + LEMON_ASSERT(i->second.type!=ArgParser::INTEGER, + std::string()+"'"+_name+"' is an integer option"); + return *(i->second.int_p); } };