[libsigcplusplus/variadic_mem_fun3: 62/148] More use of decltype(auto) for return types.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigcplusplus/variadic_mem_fun3: 62/148] More use of decltype(auto) for return types.
- Date: Mon, 7 Mar 2016 10:03:00 +0000 (UTC)
commit b72fa6e223e7567d01ba167691a3b50e51fc2d0a
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Jan 15 09:59:25 2016 +0100
More use of decltype(auto) for return types.
sigc++/adaptors/macros/retype.h.m4 | 4 ++--
sigc++/functors/macros/mem_fun.h.m4 | 15 +++++++++------
2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/sigc++/adaptors/macros/retype.h.m4 b/sigc++/adaptors/macros/retype.h.m4
index 9952a43..9970728 100644
--- a/sigc++/adaptors/macros/retype.h.m4
+++ b/sigc++/adaptors/macros/retype.h.m4
@@ -152,7 +152,7 @@ struct visitor<retype_functor<T_functor, T_type...> >
* @ingroup retype
*/
template <LIST(class T_return, class... T_arg)>
-inline retype_functor<slot<T_return, T_arg...>, T_arg...>
+inline decltype(auto)
retype(const slot<T_return, T_arg...>& _A_functor)
{ return retype_functor<slot<T_return, T_arg...>, T_arg...>
(_A_functor); }
@@ -167,7 +167,7 @@ retype(const slot<T_return, T_arg...>& _A_functor)
* @ingroup retype
*/
template <class T_return, class... T_arg>
-inline retype_functor<pointer_functor<T_return, T_arg...>, T_arg... >
+inline decltype(auto)
retype(const pointer_functor<T_return, T_arg...>& _A_functor)
{ return retype_functor<pointer_functor<T_return, T_arg...>, T_arg... >
(_A_functor); }
diff --git a/sigc++/functors/macros/mem_fun.h.m4 b/sigc++/functors/macros/mem_fun.h.m4
index 8c89cf7..cc84ab4 100644
--- a/sigc++/functors/macros/mem_fun.h.m4
+++ b/sigc++/functors/macros/mem_fun.h.m4
@@ -49,7 +49,8 @@ public:
* @param _A_a... Argument to be passed on to the method.
* @return The return value of the method invocation.
*/
- T_return operator()($2 T_obj* _A_obj, type_trait_take_t<T_arg>... _A_a) const
+ decltype(auto)
+ operator()($2 T_obj* _A_obj, type_trait_take_t<T_arg>... _A_a) const
{ return (_A_obj->*(this->func_ptr_))(_A_a...); }
/** Execute the wrapped method operating on the passed instance.
@@ -57,7 +58,8 @@ public:
* @param _A_a... Argument to be passed on to the method.
* @return The return value of the method invocation.
*/
- T_return operator()($2 T_obj& _A_obj, type_trait_take_t<T_arg>... _A_a) const
+ decltype(auto)
+ operator()($2 T_obj& _A_obj, type_trait_take_t<T_arg>... _A_a) const
{ return (_A_obj.*func_ptr_)(_A_a...); }
protected:
@@ -107,7 +109,8 @@ public:
* @param _A_a... Argument to be passed on to the method.
* @return The return value of the method invocation.
*/
- T_return operator()(type_trait_take_t<T_arg>... _A_a) const
+ decltype(auto)
+ operator()(type_trait_take_t<T_arg>... _A_a) const
{ return (obj_.invoke().*(this->func_ptr_))(_A_a...); }
//protected:
@@ -145,7 +148,7 @@ define([MEM_FUN],[dnl
* @ingroup mem_fun
*/
template <class T_return, class T_obj, class... T_arg>
-inline [$1]mem_functor<T_return, T_obj, T_arg...>
+inline decltype(auto)
mem_fun(T_return (T_obj::*_A_func)(T_arg...) $3)
{ return [$1]mem_functor<T_return, T_obj, T_arg...>(_A_func); }
@@ -159,7 +162,7 @@ define([BOUND_MEM_FUN],[dnl
* @ingroup mem_fun
*/
template <class T_return, class T_obj, class T_obj2, class... T_arg>
-inline bound_[$1]mem_functor<T_return, T_obj, T_arg...>
+inline decltype(auto)
mem_fun(/*$2*/ T_obj* _A_obj, T_return (T_obj2::*_A_func)(T_arg...) $3)
{ return bound_[$1]mem_functor<T_return, T_obj, T_arg...>(_A_obj, _A_func); }
@@ -171,7 +174,7 @@ mem_fun(/*$2*/ T_obj* _A_obj, T_return (T_obj2::*_A_func)(T_arg...) $3)
* @ingroup mem_fun
*/
template <class T_return, class T_obj, class T_obj2, class... T_arg>
-inline bound_[$1]mem_functor<T_return, T_obj, T_arg...>
+inline decltype(auto)
mem_fun(/*$2*/ T_obj& _A_obj, T_return (T_obj2::*_A_func)(T_arg...) $3)
{ return bound_[$1]mem_functor<T_return, T_obj, T_arg...>(_A_obj, _A_func); }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]