[libsigcplusplus/variadic_mem_fun3: 32/148] C++14: compose: Remove use of deduce_result_type.



commit 94136ec97f255f1275d8c53582b669e82323aaf3
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jan 8 11:37:23 2016 +0100

    C++14: compose: Remove use of deduce_result_type.
    
    By removing use of SIGC_WORKAROUND_OPERATOR_PARENTHESES, which
    hopefully isn't necessary any more.

 MSVC_Net2013/filelist.am              |    2 -
 sigc++/adaptors/adaptor_trait.h       |    8 ---
 sigc++/adaptors/bind_return.h         |    5 --
 sigc++/adaptors/compose.h             |   24 +---------
 sigc++/adaptors/exception_catch.h     |   12 -----
 sigc++/adaptors/macros/bind.h.m4      |   29 +------------
 sigc++/adaptors/macros/hide.h.m4      |   16 +------
 sigc++/adaptors/macros/retype.h.m4    |    6 ---
 sigc++/adaptors/macros/track_obj.h.m4 |    6 ---
 sigc++/adaptors/retype_return.h       |   10 ----
 tests/Makefile.am                     |    2 -
 tests/test_deduce_result_type.cc      |   76 ---------------------------------
 tests/test_visit_each.cc              |    7 +--
 13 files changed, 6 insertions(+), 197 deletions(-)
---
diff --git a/MSVC_Net2013/filelist.am b/MSVC_Net2013/filelist.am
index 3ebcc77..ca4c7f5 100644
--- a/MSVC_Net2013/filelist.am
+++ b/MSVC_Net2013/filelist.am
@@ -32,8 +32,6 @@ msvc_net2013_data =                                   \
        test_cpp11_lambda.vcxproj.filters               \
        test_custom.vcxproj                             \
        test_custom.vcxproj.filters                     \
-       test_deduce_result_type.vcxproj                 \
-       test_deduce_result_type.vcxproj.filters         \
        test_disconnect.vcxproj                         \
        test_disconnect.vcxproj.filters                 \
        test_disconnect_during_emit.vcxproj             \
diff --git a/sigc++/adaptors/adaptor_trait.h b/sigc++/adaptors/adaptor_trait.h
index 83db539..903923f 100644
--- a/sigc++/adaptors/adaptor_trait.h
+++ b/sigc++/adaptors/adaptor_trait.h
@@ -83,11 +83,6 @@ template <class T_functor> struct adapts;
 template <class T_functor>
 struct adaptor_functor : public adaptor_base
 {
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <class... T_arg>
-  struct deduce_result_type
-    { typedef sigc::deduce_result_t<T_functor, T_arg...> type; };
-#endif
   typedef typename functor_trait<T_functor>::result_type result_type;
 
   /** Invokes the wrapped functor passing on the arguments.
@@ -228,9 +223,6 @@ struct adaptor_trait<T_functor, false>
  * template <class T_functor>
  * struct my_adaptor : public sigc::adapts<T_functor>
  * {
- *   template <class T_arg1=void, class T_arg2=void>
- *   struct deduce_result_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/bind_return.h b/sigc++/adaptors/bind_return.h
index 8befe88..2e2b399 100644
--- a/sigc++/adaptors/bind_return.h
+++ b/sigc++/adaptors/bind_return.h
@@ -17,11 +17,6 @@ namespace sigc {
 template <class T_return, class T_functor>
 struct bind_return_functor : public adapts<T_functor>
 {
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <class... T_arg>
-  struct deduce_result_type
-    { typedef typename unwrap_reference<T_return>::type type; };
-#endif
   typedef typename unwrap_reference<T_return>::type result_type;
 
   /** Invokes the wrapped functor dropping its return value.
diff --git a/sigc++/adaptors/compose.h b/sigc++/adaptors/compose.h
index ea56eda..8d3a5ad 100644
--- a/sigc++/adaptors/compose.h
+++ b/sigc++/adaptors/compose.h
@@ -44,14 +44,6 @@ struct compose1_functor : public adapts<T_setter>
   typedef typename adapts<T_setter>::adaptor_type adaptor_type;
   typedef T_setter setter_type;
   typedef T_getter getter_type;
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <class... T_arg>
-  struct deduce_result_type
-    { typedef typename adaptor_type::template deduce_result_type<
-        sigc::deduce_result_t<T_getter, T_arg...>
-          >::type type; };
-#endif
   typedef typename adaptor_type::result_type  result_type;
 
   result_type
@@ -60,8 +52,7 @@ struct compose1_functor : public adapts<T_setter>
   template <class... T_arg>
   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...));
+    { return this->functor_(get_(_A_a...));
     }
 
   /** Constructs a compose1_functor object that combines the passed functors.
@@ -97,15 +88,6 @@ struct compose2_functor : public adapts<T_setter>
   typedef T_setter setter_type;
   typedef T_getter1 getter1_type;
   typedef T_getter2 getter2_type;
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <class... T_arg>
-  struct deduce_result_type
-    { typedef typename adaptor_type::template deduce_result_type<
-        typename sigc::deduce_result_t<T_getter1, T_arg...>,
-        typename sigc::deduce_result_t<T_getter2, T_arg...>
-          >::type result_type; };
-#endif
   typedef typename adaptor_type::result_type  result_type;
 
   result_type
@@ -114,9 +96,7 @@ struct compose2_functor : public adapts<T_setter>
   template <class... T_arg>
   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...>>
-        (get1_(_A_a...), get2_(_A_a...));
+    { return this->functor_(get1_(_A_a...), get2_(_A_a...));
     }
 
   /** Constructs a compose2_functor object that combines the passed functors.
diff --git a/sigc++/adaptors/exception_catch.h b/sigc++/adaptors/exception_catch.h
index ede883c..0eb6da6 100644
--- a/sigc++/adaptors/exception_catch.h
+++ b/sigc++/adaptors/exception_catch.h
@@ -58,12 +58,6 @@ template <class T_functor, class T_catcher, class T_return = typename adapts<T_f
 struct exception_catch_functor : public adapts<T_functor>
 {
   typedef typename adapts<T_functor>::adaptor_type adaptor_type;
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <class... T_arg>
-  struct deduce_result_type
-    { typedef typename adaptor_type::template deduce_result_type<type_trait_pass_t<T_arg>...>::type type; };
-#endif
   typedef T_return result_type;
 
   result_type
@@ -109,12 +103,6 @@ struct exception_catch_functor<T_functor, T_catcher, void> : public adapts<T_fun
   typedef void result_type;
   typedef typename adapts<T_functor>::adaptor_type adaptor_type;
 
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <class... T_arg>
-  struct deduce_result_type
-    { typedef typename adaptor_type::template deduce_result_type<type_trait_pass_t<T_arg>...>::type type; };
-#endif
-
   void
   operator()();
 
diff --git a/sigc++/adaptors/macros/bind.h.m4 b/sigc++/adaptors/macros/bind.h.m4
index 22f009f..7785de2 100644
--- a/sigc++/adaptors/macros/bind.h.m4
+++ b/sigc++/adaptors/macros/bind.h.m4
@@ -21,11 +21,7 @@ include(template.macros.m4)
 define([ORDINAL],[dnl
 $1[]ifelse($1,1,[st],$1,2,[nd],$1,3,[rd],[th])[]dnl
 ])
-define([DEDUCE_RESULT_TYPE_COUNT],[dnl
-  template <LOOP(class T_arg%1, eval(CALL_SIZE))>
-  struct deduce_result_type_internal<LIST($2, LOOP(T_arg%1,eval(CALL_SIZE)))>
-    { typedef typename adaptor_type::template deduce_result_type<LIST(LOOP(type_trait_pass_t<T_arg%1>, 
eval(CALL_SIZE-$2)), LOOP(type_trait_take_t<typename unwrap_reference<T_type%1>::type>, $1))>::type type; };
-])
+
 define([BIND_OPERATOR_LOCATION],[dnl
 ifelse($2,1,,[dnl
   /** Invokes the wrapped functor passing on the arguments.
@@ -88,14 +84,6 @@ template <class T_functor, class T_bound>
 struct bind_functor<$1, T_functor, T_bound, LIST(LOOP(nil, CALL_SIZE - 1))> : public adapts<T_functor>
 {
   typedef typename adapts<T_functor>::adaptor_type adaptor_type;
-
-ifelse($1,0,[#ifndef DOXYGEN_SHOULD_SKIP_THIS
-],)dnl
-  template <LOOP(class T_arg%1=void, eval(CALL_SIZE))>
-  struct deduce_result_type
-    { typedef typename adaptor_type::template deduce_result_type<LIST(LOOP(type_trait_pass_t<T_arg%1>, 
eval($1)), type_trait_pass_t<typename unwrap_reference<T_bound>::type>, 
FOR(eval($1+1),eval(CALL_SIZE-1),[type_trait_pass_t<T_arg%1>,]))>::type type; };
-ifelse($1,0,[#endif
-],)dnl
   typedef typename adaptor_type::result_type  result_type;
 
   /** Invokes the wrapped functor passing on the bound argument only.
@@ -135,21 +123,6 @@ template <LIST(class T_functor, LOOP(class T_type%1, $1))>
 struct bind_functor<LIST(-1, T_functor, LIST(LOOP(T_type%1, $1), LOOP(nil, CALL_SIZE - $1)))> : public 
adapts<T_functor>
 {
   typedef typename adapts<T_functor>::adaptor_type adaptor_type;
-
-ifelse($1,1,[#ifndef DOXYGEN_SHOULD_SKIP_THIS
-],)dnl
-  template <LIST(int count, LOOP(class T_arg%1, eval(CALL_SIZE)))>
-  struct deduce_result_type_internal
-    { typedef typename adaptor_type::template deduce_result_type<LIST(LOOP(type_trait_pass_t<T_arg%1>, 
eval(CALL_SIZE-$1)), LOOP(type_trait_pass_t<typename unwrap_reference<T_type%1>::type>, $1))>::type type; };
-FOR(eval($1+1),eval(CALL_SIZE-1),[[DEDUCE_RESULT_TYPE_COUNT($1,%1)]])dnl
-
-  template <LOOP(class T_arg%1=void, eval(CALL_SIZE))>
-  struct deduce_result_type {
-    typedef typename deduce_result_type_internal<internal::count_void<LOOP(T_arg%1, eval(CALL_SIZE))>::value,
-                                                 LOOP(T_arg%1, eval(CALL_SIZE))>::type type;
-  };
-ifelse($1,1,[#endif // DOXYGEN_SHOULD_SKIP_THIS
-],)dnl
   typedef typename adaptor_type::result_type  result_type;
 
   /** Invokes the wrapped functor passing on the bound argument only.
diff --git a/sigc++/adaptors/macros/hide.h.m4 b/sigc++/adaptors/macros/hide.h.m4
index 7625576..c4140dc 100644
--- a/sigc++/adaptors/macros/hide.h.m4
+++ b/sigc++/adaptors/macros/hide.h.m4
@@ -21,19 +21,7 @@ include(template.macros.m4)
 define([ORDINAL],[dnl
 ifelse($1,0,,$1)ifelse($1,0,[last],$1,1,[st],$1,2,[nd],$1,3,[rd],[th])[]dnl
 ])
-define([DEDUCE_RESULT_TYPE],[dnl
-ifelse(eval($1 < 2),1,[#ifndef DOXYGEN_SHOULD_SKIP_THIS
-],)dnl Only for the first two template specializations. ($1 = 0..CALL_SIZE)
-  template <LOOP(class T_arg%1=void, CALL_SIZE)>
-  struct deduce_result_type
-ifelse($1,0,[dnl
-    { typedef typename adaptor_type::template deduce_result_type<LOOP(type_trait_pass_t<T_arg%1>, 
eval($2-1))>::type type; };
-],[dnl
-    { typedef typename adaptor_type::template deduce_result_type<LIST(LOOP(type_trait_pass_t<T_arg%1>, 
eval($1-1)), FOR(eval($1+1),$2,[type_trait_pass_t<T_arg%1>,]))>::type type; };
-])dnl
-ifelse(eval($1 < 2),1,[#endif // DOXYGEN_SHOULD_SKIP_THIS
-],)dnl
-])
+
 define([HIDE_OPERATOR],[dnl
 ifelse($2,0,,[dnl
 ifelse($2,1,[dnl
@@ -112,8 +100,6 @@ template <class T_functor>
 struct hide_functor <$1, T_functor> : public adapts<T_functor>
 {
   typedef typename adapts<T_functor>::adaptor_type adaptor_type;
-
-DEDUCE_RESULT_TYPE(eval($1+1),CALL_SIZE)dnl
   typedef typename adaptor_type::result_type  result_type;
 
 FOR(eval($1+1),CALL_SIZE,[[HIDE_OPERATOR(eval($1+1),%1)]])dnl
diff --git a/sigc++/adaptors/macros/retype.h.m4 b/sigc++/adaptors/macros/retype.h.m4
index c97236b..4cc5d03 100644
--- a/sigc++/adaptors/macros/retype.h.m4
+++ b/sigc++/adaptors/macros/retype.h.m4
@@ -131,12 +131,6 @@ struct retype_functor
   : public adapts<T_functor>
 {
   typedef typename adapts<T_functor>::adaptor_type adaptor_type;
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <LOOP(class T_arg%1=void, CALL_SIZE)>
-  struct deduce_result_type
-    { typedef typename adaptor_type::template 
deduce_result_type<LOOP(type_trait_pass_t<T_arg%1>,CALL_SIZE)>::type type; };
-#endif
   typedef typename adapts<T_functor>::result_type result_type;
 
 FOR(0,CALL_SIZE,[[RETYPE_OPERATOR(%1)]])dnl
diff --git a/sigc++/adaptors/macros/track_obj.h.m4 b/sigc++/adaptors/macros/track_obj.h.m4
index 8486ac4..0f8474b 100644
--- a/sigc++/adaptors/macros/track_obj.h.m4
+++ b/sigc++/adaptors/macros/track_obj.h.m4
@@ -154,12 +154,6 @@ class track_obj_functor1 : public adapts<T_functor>
 {
 public:
   typedef typename adapts<T_functor>::adaptor_type adaptor_type;
-
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <typename... T_arg>
-  struct deduce_result_type
-    { typedef typename adaptor_type::template deduce_result_type<type_trait_pass_t<T_arg>...>::type type; };
-#endif
   typedef typename adaptor_type::result_type result_type;
 
   /** Constructs a track_obj_functor1 object that wraps the passed functor and
diff --git a/sigc++/adaptors/retype_return.h b/sigc++/adaptors/retype_return.h
index ac46a7c..4555bf4 100644
--- a/sigc++/adaptors/retype_return.h
+++ b/sigc++/adaptors/retype_return.h
@@ -16,11 +16,6 @@ namespace sigc {
 template <class T_return, class T_functor>
 struct retype_return_functor : public adapts<T_functor>
 {
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <class... T_arg>
-  struct deduce_result_type
-    { typedef T_return type; };
-#endif
   typedef T_return result_type;
 
   T_return operator()();
@@ -67,11 +62,6 @@ T_return retype_return_functor<T_return, T_functor>::operator()()
 template <class T_functor>
 struct retype_return_functor<void, T_functor> : public adapts<T_functor>
 {
-#ifndef DOXYGEN_SHOULD_SKIP_THIS
-  template <class... T_arg>
-  struct deduce_result_type
-    { typedef void type; };
-#endif
   typedef void result_type;
 
   void operator()();
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f175f32..a429c40 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,7 +31,6 @@ check_PROGRAMS = \
   test_copy_invalid_slot \
   test_cpp11_lambda \
   test_custom \
-  test_deduce_result_type \
   test_disconnect \
   test_disconnect_during_emit \
   test_exception_catch \
@@ -68,7 +67,6 @@ test_compose_SOURCES         = test_compose.cc $(sigc_test_util)
 test_copy_invalid_slot_SOURCES = test_copy_invalid_slot.cc $(sigc_test_util)
 test_cpp11_lambda_SOURCES    = test_cpp11_lambda.cc $(sigc_test_util)
 test_custom_SOURCES          = test_custom.cc $(sigc_test_util)
-test_deduce_result_type_SOURCES = test_deduce_result_type.cc $(sigc_test_util)
 test_disconnect_SOURCES      = test_disconnect.cc $(sigc_test_util)
 test_disconnect_during_emit_SOURCES = test_disconnect_during_emit.cc $(sigc_test_util)
 test_exception_catch_SOURCES = test_exception_catch.cc $(sigc_test_util)
diff --git a/tests/test_visit_each.cc b/tests/test_visit_each.cc
index a63fa43..119ee10 100644
--- a/tests/test_visit_each.cc
+++ b/tests/test_visit_each.cc
@@ -88,9 +88,6 @@ namespace ns1
 template <class T_functor>
 struct MyAdaptor1 : public sigc::adapts<T_functor>
 {
-  template <class T_arg1=void, class T_arg2=void>
-  struct deduce_result_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
@@ -101,7 +98,7 @@ struct MyAdaptor1 : public sigc::adapts<T_functor>
   }
 
   template <class T_arg1>
-  typename deduce_result_type<T_arg1>::type
+  decltype(auto)
   operator()(T_arg1 _A_arg1) const
   {
     result_stream << "MyAdaptor1()(_A_arg1) ";
@@ -109,7 +106,7 @@ struct MyAdaptor1 : public sigc::adapts<T_functor>
   }
 
   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
   {
     result_stream << "MyAdaptor1()(_A_arg1, _A_arg2) ";


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