[libsigcplusplus/variadic_mem_fun3: 78/148] bind: Some perfect forwarding.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus/variadic_mem_fun3: 78/148] bind: Some perfect forwarding.
- Date: Mon, 7 Mar 2016 10:04:21 +0000 (UTC)
commit 2cfdf3b18ca7f7cf6e8e926699d73a631689cb49
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Feb 19 11:36:56 2016 +0100
bind: Some perfect forwarding.
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))...);
}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]