1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-05-01 21:23:52 +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 /// This class is simply to allow tests access to App's protected functions
struct AppFriend { struct AppFriend {
/// Wrap _parse_short /// Wrap _parse_short, perfectly forward arguments and return
static void parse_short(App* app, std::vector<std::string> &args) { template<typename ...Args>
return app->_parse_short(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) { /// Wrap _parse_long, perfectly forward arguments and return
return app->_parse_long(args); 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)...);
} }
}; };
} }