cxxopts
cxxopts copied to clipboard
Vector input needs brackets on CLI
The README shows that to pass in a vector we need to do something like
--my_list=1,-2.1,3,4.5
whereas this does not work.
We need to do,
--my_list={1,-2.1,3,4.5}
for the library to parse correctly. Otherwise it will only parse the first value.
I can make a PR to fix the readme if the author or other users also verify this.
@jarro2783 ?
Sorry I missed this one. I think the first should actually work. There is code that looks like it might do it, so clearly there is a bug.
I noticed the first does appear to work fine in the examples, but like @PuneetKohli I couldn't replicate the same behaviour when including in my own project, at least out of the box (apologies I didn't look any further).
@wardw If it helps, I'm just using the 2nd option right now everywhere in my code.
+1 for @wardw . Option 2 works
Can you show me some code that reproduces this. Using the example file I get this:
src/example --vector=1,2,3,4
vector = 1, 2, 3, 4,
so it looks like it's working.
hello, IMHO the problem with the example is that in the sequence 1,-2.1,3,4.5
the values are of different types: the 1st one is an integer, the second one is a floating point number