1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-01 13:13:53 +00:00

Adding forwarding version of hlpers

This commit is contained in:
Henry Fredrick Schreiner 2017-03-08 10:44:30 -05:00
parent 33f4c5783a
commit 4af3faef80

View File

@ -1048,16 +1048,20 @@ namespace detail {
/// This class is simply to allow tests access to App's protected functions
struct AppFriend {
/// Wrap _parse_short
static void parse_short(App* app, std::vector<std::string> &args) {
return app->_parse_short(args);
/// Wrap _parse_short, perfectly forward arguments and return
template<typename ...Args>
static auto parse_short(App* app, Args && ...args)
-> typename std::result_of<decltype(&App::_parse_short)(App, Args...)>::type {
return app->_parse_short(std::forward<Args>(args)...);
}
/// Wrap _parse_long
static void parse_long(App* app, std::vector<std::string> &args) {
return app->_parse_long(args);
/// Wrap _parse_long, perfectly forward arguments and return
template<typename ...Args>
static auto parse_long(App* app, Args && ...args)
-> typename std::result_of<decltype(&App::_parse_long)(App, Args...)>::type {
return app->_parse_long(std::forward<Args>(args)...);
}
};
}