allow empty string to be valid positional arguments
This commit is contained in:
parent
4a0af0e950
commit
4237b15a76
@ -743,6 +743,12 @@ namespace cxxopts
|
|||||||
void
|
void
|
||||||
parse_value(const std::string& text, std::vector<T>& value)
|
parse_value(const std::string& text, std::vector<T>& value)
|
||||||
{
|
{
|
||||||
|
if (text.empty()) {
|
||||||
|
T v;
|
||||||
|
parse_value(text, v);
|
||||||
|
value.emplace_back(std::move(v));
|
||||||
|
return;
|
||||||
|
}
|
||||||
std::stringstream in(text);
|
std::stringstream in(text);
|
||||||
std::string token;
|
std::string token;
|
||||||
while(in.eof() == false && std::getline(in, token, CXXOPTS_VECTOR_DELIMITER)) {
|
while(in.eof() == false && std::getline(in, token, CXXOPTS_VECTOR_DELIMITER)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user