diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-02-19 11:36:56 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-02-19 11:50:34 +0100 |
commit | 43780608cb651cd90ff4abc7d6be7df782c74cbb (patch) | |
tree | c47badc744c1cc557150b17805b98a8a1d5ba16b | |
parent | 78f0a228ecdbfe4d73f6fea2be686e65f77b6eca (diff) | |
download | sigc++-43780608cb651cd90ff4abc7d6be7df782c74cbb.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 d3ccfa6..b24dae7 100644 --- a/sigc++/adaptors/bind.h +++ b/sigc++/adaptors/bind.h @@ -170,10 +170,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))...); } }; @@ -196,12 +196,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); @@ -228,10 +228,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))...); } }; |