diff options
author | Taylor C. Richberger <taywee@gmx.com> | 2019-06-25 13:17:17 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-25 13:17:17 -0600 |
commit | b92191364de31abea947a201151f5a844a572e97 (patch) | |
tree | 544ed67d72e5849a65848bf20e3771c4cd0ae27d /args.hxx | |
parent | Merge pull request #73 from zhihaoy/cmake-targets (diff) | |
parent | Fixes #75 : Check istringstream state in ValueParser (diff) | |
download | args.hxx-b92191364de31abea947a201151f5a844a572e97.tar.xz |
Merge pull request #76 from pavel-belikov/fix-default-value-parser
Check istringstream state in ValueParser
Diffstat (limited to 'args.hxx')
-rw-r--r-- | args.hxx | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -3256,9 +3256,14 @@ namespace args operator ()(const std::string &name, const std::string &value, T &destination) { std::istringstream ss(value); - ss >> destination >> std::ws; + bool failed = !(ss >> destination); - if (ss.rdbuf()->in_avail() > 0) + if (!failed) + { + ss >> std::ws; + } + + if (ss.rdbuf()->in_avail() > 0 || failed) { #ifdef ARGS_NOEXCEPT (void)name; |