Add add_choices accepting std::vector to argparse for convenience.
(cherry picked from commit 1126227206
)
This commit is contained in:
parent
27e4b2276b
commit
fab52bd95a
|
@ -783,6 +783,12 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T> Argument &add_choices(std::vector<T> &&choices) {
|
||||||
|
for (T &choice : choices)
|
||||||
|
add_choice(std::forward<T>(choice));
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, typename... U>
|
template <typename T, typename... U>
|
||||||
Argument &choices(T &&first, U &&... rest) {
|
Argument &choices(T &&first, U &&... rest) {
|
||||||
add_choice(std::forward<T>(first));
|
add_choice(std::forward<T>(first));
|
||||||
|
|
Loading…
Reference in New Issue