From b8672980930eaffcae86c66000f61628a66bec3a Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sat, 2 Apr 2016 13:36:32 +1100 Subject: [PATCH] cmdopt: don't throw at end of option text --- cmdopt.ipp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmdopt.ipp b/cmdopt.ipp index c98593b0..c77711ee 100644 --- a/cmdopt.ipp +++ b/cmdopt.ipp @@ -38,15 +38,13 @@ namespace util { namespace cmdopt { option::value::execute (const char *restrict str) { try { - std::istringstream os (str); - os.exceptions ( + std::istringstream is (str); + is.exceptions ( std::istringstream::failbit | std::istringstream::badbit ); - os >> m_data; - if (!os.eof ()) - throw invalid_value (__func__); + is >> m_data; } catch (...) { throw invalid_value (__func__); }