diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-02-19 11:36:56 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-03-02 20:48:54 +0100 |
commit | 5a3f71e72d9a083024966b8cb2bf1f4f1a4b8bf6 (patch) | |
tree | b1c828b68a12a835b7af60a7ce0755f7169ac318 | |
parent | 1b00a39a32a92b825ab03b66412789396b985380 (diff) | |
download | sigc++-5a3f71e72d9a083024966b8cb2bf1f4f1a4b8bf6.tar.gz |
bind: Some perfect forwarding.
-rw-r--r-- | sigc++/adaptors/bind.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sigc++/adaptors/bind.h b/sigc++/adaptors/bind.h index fef248e..3f5cf32 100644 --- a/sigc++/adaptors/bind.h +++ b/sigc++/adaptors/bind.h @@ -169,10 +169,10 @@ struct bind_functor : public adapts<T_functor> private: template<class T_specific, class T, std::size_t... Is> decltype(auto) - call_functor_operator_parentheses(T& tuple, + call_functor_operator_parentheses(T&& tuple, std::index_sequence<Is...>) { - return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename std::tuple_element<Is, T_specific>::type...>(std::get<Is>(tuple)...); + return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename std::tuple_element<Is, T_specific>::type...>(std::get<Is>(std::forward<T>(tuple))...); } }; @@ -195,12 +195,12 @@ struct bind_functor<-1, T_functor, T_type...> : public adapts<T_functor> */ template <class... T_arg> decltype(auto) - operator()(T_arg... _A_arg) + operator()(T_arg&&... _A_arg) { //For instance, if _A_arg has 4 arguments, //we would want to call operator() with (_A_arg0, _A_arg1, _A_arg2, bound). - auto t_args = std::tuple<T_arg...>(_A_arg...); + auto t_args = std::tuple<T_arg...>(std::forward<T_arg>(_A_arg)...); auto t_bound = tuple_transform_each<internal::TransformEachInvoker>(bound_); auto t_with_bound = std::tuple_cat(t_args, t_bound); @@ -227,10 +227,10 @@ struct bind_functor<-1, T_functor, T_type...> : public adapts<T_functor> private: template<class T_specific, class T, std::size_t... Is> decltype(auto) - call_functor_operator_parentheses(T& tuple, + call_functor_operator_parentheses(T&& tuple, std::index_sequence<Is...>) { - return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename std::tuple_element<Is, T_specific>::type...>(std::get<Is>(tuple)...); + return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename std::tuple_element<Is, T_specific>::type...>(std::get<Is>(std::forward<T>(tuple))...); } }; |