[libsigcplusplus] Remove all remaining result_type aliases.



commit 53bbbe7c8c72224ae3c6b647706857218936d833
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Apr 13 21:15:07 2016 +0200

    Remove all remaining result_type aliases.
    
    They are not actually needed by anything.

 sigc++/adaptors/adaptor_base.h    |    3 --
 sigc++/adaptors/adapts.h          |    3 +-
 sigc++/adaptors/bind.h            |    4 --
 sigc++/adaptors/bind_return.h     |    2 -
 sigc++/adaptors/compose.h         |    2 -
 sigc++/adaptors/exception_catch.h |   43 ++-------------------------
 sigc++/adaptors/hide.h            |    2 -
 sigc++/adaptors/retype.h          |    2 -
 sigc++/adaptors/retype_return.h   |    4 --
 sigc++/adaptors/track_obj.h       |    2 -
 sigc++/functors/functor_trait.h   |   58 -------------------------------------
 sigc++/functors/mem_fun.h         |    2 -
 sigc++/functors/ptr_fun.h         |    1 -
 sigc++/functors/slot.h            |    1 -
 tests/test_compose.cc             |    6 ----
 tests/test_hide.cc                |    5 ---
 tests/test_visit_each.cc          |    4 +--
 17 files changed, 6 insertions(+), 138 deletions(-)
---
diff --git a/sigc++/adaptors/adaptor_base.h b/sigc++/adaptors/adaptor_base.h
index 92a7b8a..55f412d 100644
--- a/sigc++/adaptors/adaptor_base.h
+++ b/sigc++/adaptors/adaptor_base.h
@@ -9,9 +9,6 @@ namespace sigc
  * Functors which have all methods based on templates
  * should publicly inherit from this hint.
  *
- * adaptor_base inherits from the functor_base hint so
- * derived types should also have a result_type defined.
- *
  * Adaptors don't inherit from this type directly. They use
  * use sigc::adapts as a base type instead. sigc::adaptors
  * wraps arbitrary functor types as well as function pointers
diff --git a/sigc++/adaptors/adapts.h b/sigc++/adaptors/adapts.h
index c7af3a6..a88461d 100644
--- a/sigc++/adaptors/adapts.h
+++ b/sigc++/adaptors/adapts.h
@@ -27,9 +27,8 @@ namespace sigc
  * template <class T_functor>
  * struct my_adaptor : public sigc::adapts<T_functor>
  * {
- *   using result_type = typename sigc::functor_trait<T_functor>::result_type;
  *   //
- *   result_type
+ *   decltype(auto)
  *   operator()() const;
  *   //
  *   template <class T_arg1>
diff --git a/sigc++/adaptors/bind.h b/sigc++/adaptors/bind.h
index 0d9a02c..59bd4e6 100644
--- a/sigc++/adaptors/bind.h
+++ b/sigc++/adaptors/bind.h
@@ -107,8 +107,6 @@ struct TransformEachInvoker
 template <int I_location, class T_functor, class... T_bound>
 struct bind_functor : public adapts<T_functor>
 {
-  using result_type = typename functor_trait<T_functor>::result_type;
-
   /** Invokes the wrapped functor passing on the arguments.
    * bound_ is passed as the next argument.
    * @param _A_arg Arguments to be passed on to the functor.
@@ -167,8 +165,6 @@ template <class T_functor, class... T_type>
 struct bind_functor<-1, T_functor, T_type...> : public adapts<T_functor>
 {
 public:
-  using result_type = typename functor_trait<T_functor>::result_type;
-
   /** Invokes the wrapped functor passing on the arguments.
    * bound_ is passed as the next argument.
    * @param _A_arg Arguments to be passed on to the functor.
diff --git a/sigc++/adaptors/bind_return.h b/sigc++/adaptors/bind_return.h
index 74c4738..47296bc 100644
--- a/sigc++/adaptors/bind_return.h
+++ b/sigc++/adaptors/bind_return.h
@@ -19,8 +19,6 @@ namespace sigc
 template <class T_return, class T_functor>
 struct bind_return_functor : public adapts<T_functor>
 {
-  using result_type = typename unwrap_reference<T_return>::type;
-
   /** Invokes the wrapped functor dropping its return value.
    * @return The fixed return value.
    */
diff --git a/sigc++/adaptors/compose.h b/sigc++/adaptors/compose.h
index 2e5af90..bd4ef93 100644
--- a/sigc++/adaptors/compose.h
+++ b/sigc++/adaptors/compose.h
@@ -45,7 +45,6 @@ struct compose1_functor : public adapts<T_setter>
 {
   using setter_type = T_setter;
   using getter_type = T_getter;
-  using result_type = typename functor_trait<T_setter>::result_type;
 
   decltype(auto) operator()() { return this->functor_(get_()); }
 
@@ -88,7 +87,6 @@ public:
   using setter_type = T_setter;
   using getter1_type = T_getter1;
   using getter2_type = T_getter2;
-  using result_type = typename adaptor_type::result_type;
 
   decltype(auto) operator()() { return this->functor_(get1_(), get2_()); }
 
diff --git a/sigc++/adaptors/exception_catch.h b/sigc++/adaptors/exception_catch.h
index 1bddd7c..164fd91 100644
--- a/sigc++/adaptors/exception_catch.h
+++ b/sigc++/adaptors/exception_catch.h
@@ -55,13 +55,9 @@ namespace sigc
  * @ingroup adaptors
  */
 
-template <class T_functor, class T_catcher,
-  class T_return = typename functor_trait<T_functor>::result_type>
+template <class T_functor, class T_catcher>
 struct exception_catch_functor : public adapts<T_functor>
 {
-public:
-  using result_type = T_return;
-
   decltype(auto) operator()()
   {
     try
@@ -95,45 +91,14 @@ public:
   T_catcher catcher_;
 };
 
-// void specialization
-template <class T_functor, class T_catcher>
-struct exception_catch_functor<T_functor, T_catcher, void> : public adapts<T_functor>
-{
-public:
-  using result_type = void;
-
-
-  template <class... T_arg>
-  decltype(auto) operator()(T_arg... _A_a)
-  {
-    try
-    {
-      return this->functor_.template operator()<type_trait_pass_t<T_arg>...>(_A_a...);
-    }
-    catch (...)
-    {
-      return catcher_();
-    }
-  }
-
-  exception_catch_functor() = default;
-  exception_catch_functor(const T_functor& _A_func, const T_catcher& _A_catcher)
-  : adapts<T_functor>(_A_func), catcher_(_A_catcher)
-  {
-  }
-  ~exception_catch_functor() = default;
-
-  T_catcher catcher_;
-};
-
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 // template specialization of visitor<>::do_visit_each<>(action, functor):
-template <class T_functor, class T_catcher, class T_return>
-struct visitor<exception_catch_functor<T_functor, T_catcher, T_return>>
+template <class T_functor, class T_catcher>
+struct visitor<exception_catch_functor<T_functor, T_catcher>>
 {
   template <typename T_action>
   static void do_visit_each(const T_action& _A_action,
-    const exception_catch_functor<T_functor, T_catcher, T_return>& _A_target)
+    const exception_catch_functor<T_functor, T_catcher>& _A_target)
   {
     sigc::visit_each(_A_action, _A_target.functor_);
     sigc::visit_each(_A_action, _A_target.catcher_);
diff --git a/sigc++/adaptors/hide.h b/sigc++/adaptors/hide.h
index 4994113..78e379c 100644
--- a/sigc++/adaptors/hide.h
+++ b/sigc++/adaptors/hide.h
@@ -69,8 +69,6 @@ namespace sigc
 template <int I_location, class T_functor>
 struct hide_functor : public adapts<T_functor>
 {
-  using result_type = typename functor_trait<T_functor>::result_type;
-
   /** Invokes the wrapped functor, ignoring the argument at index @e I_location (0-indexed).
    * @param _A_a Arguments to be passed on to the functor, apart from the ignored argument.
    * @return The return value of the functor invocation.
diff --git a/sigc++/adaptors/retype.h b/sigc++/adaptors/retype.h
index db30056..7e75e47 100644
--- a/sigc++/adaptors/retype.h
+++ b/sigc++/adaptors/retype.h
@@ -61,8 +61,6 @@ namespace sigc
 template <class T_functor, class... T_type>
 struct retype_functor : public adapts<T_functor>
 {
-  using result_type = typename functor_trait<T_functor>::result_type;
-
   template <class... T_arg>
   decltype(auto) operator()(T_arg... _A_a)
   {
diff --git a/sigc++/adaptors/retype_return.h b/sigc++/adaptors/retype_return.h
index 5551d92..bbe8241 100644
--- a/sigc++/adaptors/retype_return.h
+++ b/sigc++/adaptors/retype_return.h
@@ -18,8 +18,6 @@ namespace sigc
 template <class T_return, class T_functor>
 struct retype_return_functor : public adapts<T_functor>
 {
-  using result_type = T_return;
-
   T_return operator()();
 
   template <class... T_arg>
@@ -60,8 +58,6 @@ retype_return_functor<T_return, T_functor>::operator()()
 template <class T_functor>
 struct retype_return_functor<void, T_functor> : public adapts<T_functor>
 {
-  using result_type = void;
-
   void operator()();
 
   template <class... T_arg>
diff --git a/sigc++/adaptors/track_obj.h b/sigc++/adaptors/track_obj.h
index eab2bfc..f1b2f71 100644
--- a/sigc++/adaptors/track_obj.h
+++ b/sigc++/adaptors/track_obj.h
@@ -52,8 +52,6 @@ template <typename T_functor, typename... T_obj>
 class track_obj_functor : public adapts<T_functor>
 {
 public:
-  using result_type = typename functor_trait<T_functor>::result_type;
-
   /** Constructs a track_obj_functor object that wraps the passed functor and
    * stores a reference to the passed trackable objects.
    * @param _A_func Functor.
diff --git a/sigc++/functors/functor_trait.h b/sigc++/functors/functor_trait.h
index a0df4c0..f858f00 100644
--- a/sigc++/functors/functor_trait.h
+++ b/sigc++/functors/functor_trait.h
@@ -44,10 +44,6 @@ namespace sigc
  *   whose result type can't be deduced in any other way.
  *
  * If all these ways to deduce the result type fail, void is assumed.
- *
- * With libsigc++ versions before 2.6, the macro
- * #SIGC_FUNCTORS_DEDUCE_RESULT_TYPE_WITH_DECLTYPE activated the test with
- * decltype(). That macro is now unneccesary and deprecated.
  */
 
 /** Helper class, to determine if decltype() can deduce the result type of a functor.
@@ -98,7 +94,6 @@ template <class T_functor,
   bool I_can_use_decltype = can_deduce_result_type_with_decltype<T_functor>::value>
 struct functor_trait
 {
-  using result_type = void;
   using functor_type = T_functor;
 };
 
@@ -106,66 +101,16 @@ struct functor_trait
 template <class T_functor, bool I_can_use_decltype>
 struct functor_trait<T_functor, true, I_can_use_decltype>
 {
-  using result_type = typename T_functor::result_type;
   using functor_type = T_functor;
 };
 
 template <typename T_functor>
 struct functor_trait<T_functor, false, true>
 {
-  using result_type =
-    typename functor_trait<decltype(&T_functor::operator()), false, false>::result_type;
   using functor_type = T_functor;
 };
 #endif // DOXYGEN_SHOULD_SKIP_THIS
 
-/** Helper macro, if you want to mix user-defined and third party functors with libsigc++.
- *
- * If you want to mix functors not derived from sigc::functor_base with libsigc++, and
- * these functors define @p result_type, use this macro inside namespace sigc like so:
- * @code
- * namespace sigc { SIGC_FUNCTORS_HAVE_RESULT_TYPE }
- * @endcode
- *
- * @ingroup sigcfunctors
- */
-#define SIGC_FUNCTORS_HAVE_RESULT_TYPE                   \
-  template <class T_functor>                             \
-  struct functor_trait<T_functor, false, false>          \
-  {                                                      \
-    using result_type = typename T_functor::result_type; \
-    using functor_type = T_functor;                      \
-  };
-
-/** Helper macro, if you want to mix user-defined and third party functors with libsigc++.
- *
- * If you want to mix functors not derived from sigc::functor_base with libsigc++, and
- * these functors don't define @p result_type, use this macro inside namespace sigc
- * to expose the return type of the functors like so:
- * @code
- * namespace sigc {
- *   SIGC_FUNCTOR_TRAIT(first_functor_type, return_type_of_first_functor_type)
- *   SIGC_FUNCTOR_TRAIT(second_functor_type, return_type_of_second_functor_type)
- *   ...
- * }
- * @endcode
- *
- * @ingroup sigcfunctors
- */
-#define SIGC_FUNCTOR_TRAIT(T_functor, T_return) \
-  template <>                                   \
-  struct functor_trait<T_functor, false, false> \
-  {                                             \
-    using result_type = T_return;               \
-    using functor_type = T_functor;             \
-  };                                            \
-  template <>                                   \
-  struct functor_trait<T_functor, false, true>  \
-  {                                             \
-    using result_type = T_return;               \
-    using functor_type = T_functor;             \
-  };
-
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
 // detect the return type and the functor version of non-functor types.
 
@@ -174,7 +119,6 @@ struct functor_trait<T_functor, false, true>
 template <class T_return, class... T_arg>
 struct functor_trait<T_return (*)(T_arg...), false, false>
 {
-  using result_type = T_return;
   using functor_type = pointer_functor<T_return(T_arg...)>;
 };
 
@@ -183,14 +127,12 @@ struct functor_trait<T_return (*)(T_arg...), false, false>
 template <class T_return, class T_obj, class... T_arg>
 struct functor_trait<T_return (T_obj::*)(T_arg...), false, false>
 {
-  using result_type = T_return;
   using functor_type = mem_functor<T_return (T_obj::*)(T_arg...), T_arg...>;
 };
 
 template <class T_return, class T_obj, class... T_arg>
 struct functor_trait<T_return (T_obj::*)(T_arg...) const, false, false>
 {
-  using result_type = T_return;
   using functor_type = mem_functor<T_return (T_obj::*)(T_arg...) const, T_arg...>;
 };
 
diff --git a/sigc++/functors/mem_fun.h b/sigc++/functors/mem_fun.h
index 3f3ef1f..b4c9c13 100644
--- a/sigc++/functors/mem_fun.h
+++ b/sigc++/functors/mem_fun.h
@@ -75,7 +75,6 @@ public:
   using object_type = typename internal::member_method_class<T_func>::type;
 
   using function_type = T_func;
-  using result_type = typename internal::member_method_result<T_func>::type;
 
   using obj_type_with_modifier =
     typename std::conditional_t<internal::member_method_is_const<T_func>::value, const object_type,
@@ -110,7 +109,6 @@ class bound_mem_functor : mem_functor<T_func, T_arg...>
 
 public:
   using function_type = typename base_type::function_type;
-  using result_type = typename base_type::result_type;
 
   using object_type = typename base_type::object_type;
 
diff --git a/sigc++/functors/ptr_fun.h b/sigc++/functors/ptr_fun.h
index 1c628bd..cff269a 100644
--- a/sigc++/functors/ptr_fun.h
+++ b/sigc++/functors/ptr_fun.h
@@ -61,7 +61,6 @@ protected:
   function_type func_ptr_;
 
 public:
-  using result_type = T_return;
 
   /// Constructs an invalid functor.
   pointer_functor() = default;
diff --git a/sigc++/functors/slot.h b/sigc++/functors/slot.h
index 91b42cd..4dacb87 100644
--- a/sigc++/functors/slot.h
+++ b/sigc++/functors/slot.h
@@ -156,7 +156,6 @@ template <class T_return, class... T_arg>
 class slot<T_return(T_arg...)> : public slot_base
 {
 public:
-  using result_type = T_return;
 // TODO: using arg_type_ = type_trait_take_t<T_arg>;
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
diff --git a/tests/test_compose.cc b/tests/test_compose.cc
index 414947e..51f8e72 100644
--- a/tests/test_compose.cc
+++ b/tests/test_compose.cc
@@ -8,12 +8,6 @@
 #include <sstream>
 #include <cstdlib>
 
-// assume existance of T_functor::result_type for unknown functor types:
-namespace sigc
-{
-SIGC_FUNCTORS_HAVE_RESULT_TYPE
-}
-
 namespace
 {
 std::ostringstream result_stream;
diff --git a/tests/test_hide.cc b/tests/test_hide.cc
index 7f67688..e8724ab 100644
--- a/tests/test_hide.cc
+++ b/tests/test_hide.cc
@@ -39,11 +39,6 @@ struct foo_void : public sigc::functor_base
 
 } // end anonymous namespace
 
-namespace sigc
-{
-SIGC_FUNCTOR_TRAIT(foo, bool)
-}
-
 int
 main(int argc, char* argv[])
 {
diff --git a/tests/test_visit_each.cc b/tests/test_visit_each.cc
index c47fca1..a22b620 100644
--- a/tests/test_visit_each.cc
+++ b/tests/test_visit_each.cc
@@ -84,9 +84,7 @@ namespace ns1
 template <class T_functor>
 struct MyAdaptor1 : public sigc::adapts<T_functor>
 {
-  using result_type = typename sigc::functor_trait<T_functor>::result_type;
-
-  result_type operator()() const
+  decltype(auto) operator()() const
   {
     result_stream << "MyAdaptor1()() ";
     return this->functor_();


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