Allow iterator inputs to parse_positional

This commit is contained in:
Jarryd Beck 2018-07-05 18:21:26 +10:00
parent 95a48de820
commit 7c468aaf68
3 changed files with 13 additions and 1 deletions

View File

@ -9,6 +9,10 @@ options. The project adheres to semantic versioning.
* Allow integers to have leading zeroes.
### Added
* Iterator inputs to `parse_positional`.
### Bug Fixes
* Fix a warning about possible loss of data.

View File

@ -1255,6 +1255,12 @@ namespace cxxopts
void
parse_positional(std::initializer_list<std::string> options);
template <typename Iterator>
void
parse_positional(Iterator begin, Iterator end) {
parse_positional(std::vector<std::string>{begin, end});
}
std::string
help(const std::vector<std::string>& groups = {""}) const;

View File

@ -145,7 +145,9 @@ TEST_CASE("All positional", "[positional]")
auto argc = av.argc();
auto argv = av.argv();
options.parse_positional({"positional"});
std::vector<std::string> pos_names = {"positional"};
options.parse_positional(pos_names.begin(), pos_names.end());
auto result = options.parse(argc, argv);