[libsigc++2/variadic] C++14: operator(): Use decltype(auto) instead of deduce_result_type.



commit 50f57e84fe7df6c0867980178d782769cdb42235
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jan 8 11:34:30 2016 +0100

    C++14: operator(): Use decltype(auto) instead of deduce_result_type.
    
    So we can remove all the nasty deduce_result_type code,
    which is hard to make fully variadic in bind().

 sigc++/adaptors/adaptor_trait.h       |    8 ++++----
 sigc++/adaptors/compose.h             |    4 ++--
 sigc++/adaptors/exception_catch.h     |    4 ++--
 sigc++/adaptors/macros/bind.h.m4      |    8 ++++----
 sigc++/adaptors/macros/hide.h.m4      |   12 ++++++------
 sigc++/adaptors/macros/retype.h.m4    |    4 ++--
 sigc++/adaptors/macros/track_obj.h.m4 |    4 ++--
 7 files changed, 22 insertions(+), 22 deletions(-)
---
diff --git a/sigc++/adaptors/adaptor_trait.h b/sigc++/adaptors/adaptor_trait.h
index 58886a6..83db539 100644
--- a/sigc++/adaptors/adaptor_trait.h
+++ b/sigc++/adaptors/adaptor_trait.h
@@ -107,13 +107,13 @@ struct adaptor_functor : public adaptor_base
    * @return The return value of the functor invocation.
    */
   template <class... T_arg>
-  typename deduce_result_type<T_arg...>::type
+  decltype(auto)
   operator()(T_arg... _A_arg) const
     { return functor_(_A_arg...); }
 
   #ifndef SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
   template <class... T_arg>
-  typename deduce_result_type<T_arg...>::type
+  decltype(auto)
   sun_forte_workaround(T_arg... _A_arg) const
     { //Just calling operator() tries to copy the argument:
       return functor_(_A_arg...);
@@ -237,11 +237,11 @@ struct adaptor_trait<T_functor, false>
  *   operator()() const;
  *   //
  *   template <class T_arg1>
- *   typename deduce_result_type<T_arg1>::type
+ *   decltype(auto)
  *   operator()(T_arg1 _A_arg1) const;
  *   //
  *   template <class T_arg1, class T_arg2>
- *   typename deduce_result_type<T_arg1, T_arg2>::type
+ *   decltype(auto)
  *   operator()(T_arg1 _A_arg1, T_arg2 _A_arg2) const;
  *   //
  *   // Constructs a my_adaptor object that wraps the passed functor.
diff --git a/sigc++/adaptors/compose.h b/sigc++/adaptors/compose.h
index 667d734..ea56eda 100644
--- a/sigc++/adaptors/compose.h
+++ b/sigc++/adaptors/compose.h
@@ -58,7 +58,7 @@ struct compose1_functor : public adapts<T_setter>
   operator()();
 
   template <class... T_arg>
-  typename deduce_result_type<T_arg...>::type
+  decltype(auto)
   operator()(T_arg... _A_a)
     { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<sigc::deduce_result_t<T_getter, T_arg...>>
         (get_(_A_a...));
@@ -112,7 +112,7 @@ struct compose2_functor : public adapts<T_setter>
   operator()();
 
   template <class... T_arg>
-  typename deduce_result_type<T_arg...>::type
+  decltype(auto)
   operator()(T_arg... _A_a)
     { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<sigc::deduce_result_t<T_getter1, T_arg...>,
                                                          sigc::deduce_result_t<T_getter2, T_arg...>>
diff --git a/sigc++/adaptors/exception_catch.h b/sigc++/adaptors/exception_catch.h
index 0e0fc57..ede883c 100644
--- a/sigc++/adaptors/exception_catch.h
+++ b/sigc++/adaptors/exception_catch.h
@@ -71,7 +71,7 @@ struct exception_catch_functor : public adapts<T_functor>
 
 
   template <class... T_arg>
-  typename deduce_result_type<T_arg...>::type
+  decltype(auto)
   operator()(T_arg... _A_a)
     {
       try
@@ -120,7 +120,7 @@ struct exception_catch_functor<T_functor, T_catcher, void> : public adapts<T_fun
 
 
   template <class... T_arg>
-  typename deduce_result_type<T_arg...>::type
+  decltype(auto)
   operator()(T_arg... _A_a)
     {
       try
diff --git a/sigc++/adaptors/macros/bind.h.m4 b/sigc++/adaptors/macros/bind.h.m4
index c98bcec..dd6b143 100644
--- a/sigc++/adaptors/macros/bind.h.m4
+++ b/sigc++/adaptors/macros/bind.h.m4
@@ -35,7 +35,7 @@ FOR(1, eval($2-1),[
    * @return The return value of the functor invocation.
    */
   template <LOOP([class T_arg%1], eval($2-1))>
-  typename deduce_result_type<LOOP(T_arg%1,eval($2-1))>::type
+  decltype(auto)
   operator()(LOOP(T_arg%1 _A_arg%1,eval($2-1)))
     { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([type_trait_pass_t<T_arg%1>], 
eval($1-1)), type_trait_take_t<typename unwrap_reference<T_bound>::type>, 
FOR($1,eval($2-1),[type_trait_take_t<T_arg%1>,]))>
         (LIST(LOOP(_A_arg%1,eval($1-1)), bound_.invoke(), FOR($1,eval($2-1),[_A_arg%1,])));
@@ -43,7 +43,7 @@ FOR(1, eval($2-1),[
 
   #ifndef SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
   template <LOOP([class T_arg%1], eval($2-1))>
-  typename deduce_result_type<LOOP(T_arg%1,eval($2-1))>::type
+  decltype(auto)
   sun_forte_workaround(LOOP(T_arg%1 _A_arg%1,eval($2-1)))
     { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([type_trait_pass_t<T_arg%1>], 
eval($1-1)), type_trait_take_t<typename unwrap_reference<T_bound>::type>, 
FOR($1,eval($2-1),[type_trait_take_t<T_arg%1>,]))>
         (LIST(LOOP(_A_arg%1,eval($1-1)), bound_.invoke(), FOR($1,eval($2-1),[_A_arg%1,])));
@@ -60,7 +60,7 @@ FOR(1, eval($2-1),[
    * @return The return value of the functor invocation.
    */
   template <LOOP([class T_arg%1], eval($2-1))>
-  typename deduce_result_type<LOOP(T_arg%1,eval($2-1))>::type
+  decltype(auto)
   operator()(LOOP(T_arg%1 _A_arg%1, eval($2-1)))
     { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([type_trait_pass_t<T_arg%1>], 
eval($2-1)), LOOP(type_trait_take_t<typename unwrap_reference<T_type%1>::type>, $1))>
         (LIST(LOOP(_A_arg%1,eval($2-1)), LOOP(bound%1_.invoke(), $1)));
@@ -68,7 +68,7 @@ FOR(1, eval($2-1),[
 
   #ifndef SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
   template <LOOP([class T_arg%1], eval($2-1))>
-  typename deduce_result_type<LOOP(T_arg%1,eval($2-1))>::type
+  decltype(auto)
   sun_forte_workaround(LOOP(T_arg%1 _A_arg%1, eval($2-1)))
     { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([type_trait_pass_t<T_arg%1>], 
eval($2-1)), LOOP(type_trait_take_t<typename unwrap_reference<T_type%1>::type>, $1))>
         (LIST(LOOP(_A_arg%1,eval($2-1)), LOOP(bound%1_.invoke(), $1)));
diff --git a/sigc++/adaptors/macros/hide.h.m4 b/sigc++/adaptors/macros/hide.h.m4
index 9aba9db..7625576 100644
--- a/sigc++/adaptors/macros/hide.h.m4
+++ b/sigc++/adaptors/macros/hide.h.m4
@@ -42,13 +42,13 @@ ifelse($2,1,[dnl
    * @return The return value of the functor invocation.
    */
   template <class T_arg1>
-  typename deduce_result_type<T_arg1>::type
+  decltype(auto)
   operator()(T_arg1)
     { return this->functor_(); }
 
   #ifndef SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
   template <class T_arg1>
-  typename deduce_result_type<T_arg1>::type
+  decltype(auto)
   sun_forte_workaround(T_arg1 _A_a1)
     { return this->functor_(); }
   #endif
@@ -61,14 +61,14 @@ FOR(1, eval($2-1),[
    * @return The return value of the functor invocation.
    */
   template <LOOP([class T_arg%1], $2)>
-  typename deduce_result_type<LOOP(T_arg%1, $2)>::type
+  decltype(auto)
   operator()(LOOP(T_arg%1 _A_a%1, eval($2-1)), T_arg$2)
     { return 
this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(FOR(1,eval($2-1),[type_trait_pass_t<T_arg%1>,]))>
         (LIST(FOR(1,eval($2-1),[_A_a%1,]))); }
 
   #ifndef SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
   template <LOOP([class T_arg%1], $2)>
-  typename deduce_result_type<LOOP(T_arg%1, $2)>::type
+  decltype(auto)
   sun_forte_workaround(LOOP(T_arg%1 _A_a%1, eval($2-1)), T_arg$2)
     { return 
this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(FOR(1,eval($2-1),[type_trait_pass_t<T_arg%1>,]))>
         (LIST(FOR(1,eval($2-1),[_A_a%1,]))); }
@@ -84,14 +84,14 @@ FOR(eval($1+1), $2,[
    * @return The return value of the functor invocation.
    */
   template <LOOP([class T_arg%1], $2)>
-  typename deduce_result_type<LOOP(T_arg%1, $2)>::type
+  decltype(auto)
   operator()(LIST(FOR(1,eval($1-1),[T_arg%1 _A_a%1,]),T_arg$1,FOR(eval($1+1),$2,[T_arg%1 _A_a%1,])))
     { return 
this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(FOR(1,eval($1-1),[type_trait_pass_t<T_arg%1>,]),FOR(eval($1+1),
 $2,[type_trait_pass_t<T_arg%1>,]))>
         (LIST(FOR(1,eval($1-1),[_A_a%1,]),FOR(eval($1+1),$2,[_A_a%1,]))); }
 
   #ifndef SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
   template <LOOP([class T_arg%1], $2)>
-  typename deduce_result_type<LOOP(T_arg%1, $2)>::type
+  decltype(auto)
   sun_forte_workaround(LIST(FOR(1,eval($1-1),[T_arg%1 _A_a%1,]),T_arg$1,FOR(eval($1+1),$2,[T_arg%1 
_A_a%1,])))
     { return 
this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(FOR(1,eval($1-1),[type_trait_pass_t<T_arg%1>,]),FOR(eval($1+1),
 $2,[type_trait_pass_t<T_arg%1>,]))>
         (LIST(FOR(1,eval($1-1),[_A_a%1,]),FOR(eval($1+1),$2,[_A_a%1,]))); }
diff --git a/sigc++/adaptors/macros/retype.h.m4 b/sigc++/adaptors/macros/retype.h.m4
index 20970d7..c97236b 100644
--- a/sigc++/adaptors/macros/retype.h.m4
+++ b/sigc++/adaptors/macros/retype.h.m4
@@ -24,7 +24,7 @@ ifelse($1,0,[dnl
 
 ],[dnl
   template <LOOP(class T_arg%1, $1)>
-  typename deduce_result_type<LOOP(T_arg%1,$1)>::type
+  decltype(auto)
   operator()(LOOP(T_arg%1 _A_a%1, $1))
     { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LOOP(type_trait_take_t<T_type%1>, $1)>
         (LOOP([[static_cast<T_type%1>(_A_a%1)]], $1));
@@ -32,7 +32,7 @@ ifelse($1,0,[dnl
 
   #ifndef SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
   template <LOOP(class T_arg%1, $1)>
-  typename deduce_result_type<LOOP(T_arg%1,$1)>::type
+  decltype(auto)
   sun_forte_workaround(LOOP(T_arg%1 _A_a%1, $1))
     { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LOOP(type_trait_take_t<T_type%1>, $1)>
         (LOOP([[static_cast<T_type%1>(_A_a%1)]], $1));
diff --git a/sigc++/adaptors/macros/track_obj.h.m4 b/sigc++/adaptors/macros/track_obj.h.m4
index c621815..8486ac4 100644
--- a/sigc++/adaptors/macros/track_obj.h.m4
+++ b/sigc++/adaptors/macros/track_obj.h.m4
@@ -182,7 +182,7 @@ public:
    * @return The return value of the functor invocation.
    */
   template <typename... T_arg>
-  typename deduce_result_type<T_arg...>::type
+  decltype(auto)
   operator()(T_arg... _A_arg)
   {
     return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_pass_t<T_arg>...>
@@ -191,7 +191,7 @@ public:
 
   #ifndef SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
   template <typename... T_arg>
-  typename deduce_result_type<T_arg...>::type
+  decltype(auto)
   sun_forte_workaround(T_arg... _A_arg)
   {
     return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_pass_t<T_arg>...>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]