You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'd like an option to input two values for a parameter and take them as an input. This would differ from std::vector values in that the number of values given is constant. The use case I was trying to solve is optionally inputting a file with data and an another file with metadata describing the previous file, where the user can either include both or leave both out but including one without the other is invalid. Here's an example of what it would look like:
options.add_options()("file", "File and metadata", cxxopts::value<std::pair<std::string, std::string>>())
./main --file file1 metadata1
Ideally this could also be used with std::vector
options.add_options()("file", "File and metadata", cxxopts::value<std::vector<std::pair<std::string, std::string>>>())
The main difficulty would be parsing these together. It seems reasonable that you could split the values with a comma. Then I could support a pair or tuple and expect exactly the number of arguments in the type.
For example
Hi, I'd like an option to input two values for a parameter and take them as an input. This would differ from
std::vector
values in that the number of values given is constant. The use case I was trying to solve is optionally inputting a file with data and an another file with metadata describing the previous file, where the user can either include both or leave both out but including one without the other is invalid. Here's an example of what it would look like:Ideally this could also be used with
std::vector
and similarly with
std::tuple
for more than 2 values.The text was updated successfully, but these errors were encountered: