cxxopts
cxxopts copied to clipboard
Multiple vectors
Hi,
I would like to add an option to my application that allows repeated input of vectors.
I tried this:
("test", "vector input", cxxopts::value<std::vector<std::vector<float>>>())
const std::vector<std::vector<float>> tests = result["test"].as<std::vector<std::vector<float>>>();
when I call the application as follows:
./app --test=10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0 --test=10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0 --test=10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0,10.0
tests
contains 30 entries with each entry being a vector of size one. I would expect 3 entries with each being a vector of size 10.
Is there a way to do that right now or is this not supported.
That would need a bit of fiddling to do. Vector arguments are basically flattened out into a single vector, so I hadn't really thought of having a vector of vectors.