[libsigc++2] C++11: deduce_result_type.h: Add and use a deduce_result_t<> alias.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsigc++2] C++11: deduce_result_type.h: Add and use a deduce_result_t<> alias.
- Date: Thu, 13 Aug 2015 18:40:57 +0000 (UTC)
commit 0590de0f5232ef9b77cb3e1969035430cf608862
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Aug 13 11:57:06 2015 +0200
C++11: deduce_result_type.h: Add and use a deduce_result_t<> alias.
This simplifies the code a bit, by replacing use of this:
typename deduce_result_type<SomeType1, SomeType2>::type
with this:
deduce_result_t<SomeType1, SomeType2>
Note that the alias is a C++11 variadic template.
Bug #753580
sigc++/adaptors/macros/adaptor_trait.h.m4 | 4 ++--
sigc++/adaptors/macros/compose.h.m4 | 12 ++++++------
sigc++/adaptors/macros/deduce_result_type.h.m4 | 4 ++++
3 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/sigc++/adaptors/macros/adaptor_trait.h.m4 b/sigc++/adaptors/macros/adaptor_trait.h.m4
index 3522d7d..a7a0613 100644
--- a/sigc++/adaptors/macros/adaptor_trait.h.m4
+++ b/sigc++/adaptors/macros/adaptor_trait.h.m4
@@ -134,7 +134,7 @@ struct adaptor_functor : public adaptor_base
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <LOOP(class T_arg%1=void, CALL_SIZE)>
struct deduce_result_type
- { typedef typename sigc::deduce_result_type<LIST(T_functor, LOOP(T_arg%1,CALL_SIZE))>::type type; };
+ { typedef sigc::deduce_result_t<LIST(T_functor, LOOP(T_arg%1,CALL_SIZE))> type; };
#endif
typedef typename functor_trait<T_functor>::result_type result_type;
@@ -259,7 +259,7 @@ struct adaptor_trait<T_functor, false>
* {
* template <class T_arg1=void, class T_arg2=void>
* struct deduce_result_type
- * { typedef typename sigc::deduce_result_type<T_functor, T_arg1, T_arg2>::type type; };
+ * { typedef sigc::deduce_result_t<T_functor, T_arg1, T_arg2> type; };
* typedef typename sigc::functor_trait<T_functor>::result_type result_type;
* //
* result_type
diff --git a/sigc++/adaptors/macros/compose.h.m4 b/sigc++/adaptors/macros/compose.h.m4
index 281acb9..6cd10db 100644
--- a/sigc++/adaptors/macros/compose.h.m4
+++ b/sigc++/adaptors/macros/compose.h.m4
@@ -22,7 +22,7 @@ define([COMPOSE1_OPERATOR],[dnl
template <LOOP(class T_arg%1, $1)>
typename deduce_result_type<LOOP(T_arg%1, $1)>::type
operator()(LOOP(T_arg%1 _A_a%1, $1))
- { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename
sigc::deduce_result_type<LIST(T_getter, LOOP(T_arg%1,$1))>::type>
+ { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<sigc::deduce_result_t<LIST(T_getter,
LOOP(T_arg%1,$1))>>
(get_(LOOP(_A_a%1, $1)));
}
@@ -32,8 +32,8 @@ define([COMPOSE2_OPERATOR],[dnl
template <LOOP(class T_arg%1, $1)>
typename deduce_result_type<LOOP(T_arg%1, $1)>::type
operator()(LOOP(T_arg%1 _A_a%1, $1))
- { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<typename
sigc::deduce_result_type<LIST(T_getter1, LOOP(T_arg%1,$1))>::type,
- typename sigc::deduce_result_type<LIST(T_getter2,
LOOP(T_arg%1,$1))>::type>
+ { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<sigc::deduce_result_t<LIST(T_getter1,
LOOP(T_arg%1,$1))>,
+ sigc::deduce_result_t<LIST(T_getter2,
LOOP(T_arg%1,$1))>>
(get1_(LOOP(_A_a%1, $1)), get2_(LOOP(_A_a%1,$1)));
}
@@ -90,7 +90,7 @@ struct compose1_functor : public adapts<T_setter>
template <LOOP(class T_arg%1 = void, CALL_SIZE)>
struct deduce_result_type
{ typedef typename adaptor_type::template deduce_result_type<
- typename sigc::deduce_result_type<LIST(T_getter, LOOP(T_arg%1,CALL_SIZE))>::type
+ sigc::deduce_result_t<LIST(T_getter, LOOP(T_arg%1,CALL_SIZE))>
>::type type; };
#endif
typedef typename adaptor_type::result_type result_type;
@@ -138,8 +138,8 @@ struct compose2_functor : public adapts<T_setter>
template <LOOP(class T_arg%1=void, CALL_SIZE)>
struct deduce_result_type
{ typedef typename adaptor_type::template deduce_result_type<
- typename sigc::deduce_result_type<LIST(T_getter1, LOOP(T_arg%1,CALL_SIZE))>::type,
- typename sigc::deduce_result_type<LIST(T_getter2, LOOP(T_arg%1,CALL_SIZE))>::type
+ typename sigc::deduce_result_t<LIST(T_getter1, LOOP(T_arg%1,CALL_SIZE))>,
+ typename sigc::deduce_result_t<LIST(T_getter2, LOOP(T_arg%1,CALL_SIZE))>
>::type result_type; };
#endif
typedef typename adaptor_type::result_type result_type;
diff --git a/sigc++/adaptors/macros/deduce_result_type.h.m4 b/sigc++/adaptors/macros/deduce_result_type.h.m4
index 5d3f4ed..2f5d70c 100644
--- a/sigc++/adaptors/macros/deduce_result_type.h.m4
+++ b/sigc++/adaptors/macros/deduce_result_type.h.m4
@@ -92,6 +92,10 @@ struct deduce_result_type
#ifndef DOXYGEN_SHOULD_SKIP_THIS
FOR(0,CALL_SIZE,[[DEDUCE_RESULT_TYPE_ADAPTOR(%1,CALL_SIZE)]])dnl
+
+template<typename... T>
+using deduce_result_t = typename deduce_result_type<T...>::type;
+
#endif // DOXYGEN_SHOULD_SKIP_THIS
dnl #ifdef SIGC_CXX_TYPEOF
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]