|
|
@@ -40,13 +40,19 @@ public:
|
|
|
}
|
|
|
void run() const;
|
|
|
template <typename T> static T from_string(std::string const &);
|
|
|
+ template <typename T, size_t I>
|
|
|
+ static auto from_string(std::string const & value) {
|
|
|
+ using E = std::tuple_element_t<I, T>;
|
|
|
+ using V = std::remove_cv_t<std::remove_reference_t<E>>;
|
|
|
+ return from_string<V>(value);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
template <typename... Args, size_t... Is>
|
|
|
void cli_invoke(std::function<void(Args...)> cb, cli::args_t const & args,
|
|
|
std::index_sequence<Is...>) {
|
|
|
using tuple = std::tuple<Args...>;
|
|
|
- cb(cli::from_string<std::tuple_element_t<Is, tuple>>(args[Is])...);
|
|
|
+ cb(cli::from_string<tuple, Is>(args[Is])...);
|
|
|
}
|
|
|
|
|
|
template <typename... Args>
|