diff options
Diffstat (limited to 'boost/program_options/errors.hpp')
-rw-r--r-- | boost/program_options/errors.hpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/boost/program_options/errors.hpp b/boost/program_options/errors.hpp index f31defbd36..ba83d88f40 100644 --- a/boost/program_options/errors.hpp +++ b/boost/program_options/errors.hpp @@ -26,7 +26,12 @@ namespace boost { namespace program_options { inline std::string strip_prefixes(const std::string& text) { // "--foo-bar" -> "foo-bar" - return text.substr(text.find_first_not_of("-/")); + std::string::size_type i = text.find_first_not_of("-/"); + if (i == std::string::npos) { + return text; + } else { + return text.substr(i); + } } /** Base class for all errors in the library. */ @@ -169,7 +174,7 @@ namespace boost { namespace program_options { virtual void set_option_name(const std::string& option_name) { set_substitute("option", option_name);} - std::string get_option_name() const throw() + std::string get_option_name() const { return get_canonical_option_name(); } void set_original_token(const std::string& original_token) |