From 4af3faef80dc66f9b1a540059590006de2cb166e Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Wed, 8 Mar 2017 10:44:30 -0500 Subject: [PATCH] Adding forwarding version of hlpers --- include/CLI/App.hpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/include/CLI/App.hpp b/include/CLI/App.hpp index 6bad4201..686e3ccf 100644 --- a/include/CLI/App.hpp +++ b/include/CLI/App.hpp @@ -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 &args) { - return app->_parse_short(args); + /// Wrap _parse_short, perfectly forward arguments and return + template + static auto parse_short(App* app, Args && ...args) + -> typename std::result_of::type { + return app->_parse_short(std::forward(args)...); } - /// Wrap _parse_long - static void parse_long(App* app, std::vector &args) { - return app->_parse_long(args); + + /// Wrap _parse_long, perfectly forward arguments and return + template + static auto parse_long(App* app, Args && ...args) + -> typename std::result_of::type { + return app->_parse_long(std::forward(args)...); } - }; }