Skip to content

Commit

Permalink
use istringstream for parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
artpaul committed Apr 15, 2021
1 parent 8d2786a commit d08aba7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/cxxopts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ parse_value(const std::string& text, std::string& value);

template <typename T>
void stringstream_parser(const std::string& text, T& value) {
std::stringstream in{text};
std::istringstream in{text};
in >> value;
if (!in) {
throw_or_mimic<argument_incorrect_type>(text);
Expand Down Expand Up @@ -498,7 +498,7 @@ struct value_parser<std::vector<T>> {
parser_type().parse(ctx, text, v);
value.emplace_back(std::move(v));
} else {
std::stringstream in{text};
std::istringstream in{text};
std::string token;
while (!in.eof() && std::getline(in, token, ctx.delimiter)) {
T v;
Expand Down

0 comments on commit d08aba7

Please sign in to comment.