diff --git a/include/fc/rpc/api_connection.hpp b/include/fc/rpc/api_connection.hpp index 71eaf80..281f1d2 100644 --- a/include/fc/rpc/api_connection.hpp +++ b/include/fc/rpc/api_connection.hpp @@ -44,13 +44,18 @@ namespace fc { } template - R call_generic( const std::function& f, variants::const_iterator a0, variants::const_iterator e, uint32_t max_depth ) + R call_generic( const std::function& f, variants::const_iterator a0, + variants::const_iterator e, uint32_t max_depth ) { bool optional_args = all_optionals, std::decay_t...>::value; FC_ASSERT( a0 != e || optional_args ); FC_ASSERT( max_depth > 0, "Recursion depth exceeded!" ); - auto arg = (a0 == e)? std::decay_t() : a0->as>(max_depth - 1); - return call_generic( bind_first_arg( f, arg ), a0+1, e, max_depth - 1 ); + if (a0==e) + return call_generic( bind_first_arg( f, std::decay_t() ), a0, + e, max_depth - 1 ); + auto arg = a0->as>(max_depth - 1); + return call_generic( bind_first_arg( f, std::move(arg) ), a0+1, e, + max_depth - 1 ); } template @@ -180,13 +185,18 @@ namespace fc { } template - R call_generic( const std::function& f, variants::const_iterator a0, variants::const_iterator e, uint32_t max_depth ) + R call_generic( const std::function& f, variants::const_iterator a0, + variants::const_iterator e, uint32_t max_depth ) { bool optional_args = detail::all_optionals, std::decay_t...>::value; FC_ASSERT( a0 != e || optional_args, "too few arguments passed to method" ); FC_ASSERT( max_depth > 0, "Recursion depth exceeded!" ); - auto arg = (a0 == e)? std::decay_t() : a0->as>(max_depth - 1); - return call_generic( this->bind_first_arg( f, arg ), a0+1, e, max_depth - 1 ); + if (a0==e) + return call_generic( this->bind_first_arg( f, std::decay_t() ), a0, + e, max_depth - 1 ); + auto arg = a0->as>(max_depth - 1); + return call_generic( this->bind_first_arg( f, std::move(arg) ), a0+1, e, + max_depth - 1 ); } struct api_visitor