[libsigc++2/variadic_bind2: 19/68] bind(): Make this variadic.



commit de456745173ff1dda25b62cb6eb371cf556091d0
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jan 8 15:56:19 2016 +0100

    bind(): Make this variadic.
    
    Instead of generating many versions.
    
    bind_functor<> is not at all variadic yet.

 sigc++/adaptors/macros/bind.h.m4 |   40 ++++++++++++++++---------------------
 1 files changed, 17 insertions(+), 23 deletions(-)
---
diff --git a/sigc++/adaptors/macros/bind.h.m4 b/sigc++/adaptors/macros/bind.h.m4
index c6ae2f3..96db325 100644
--- a/sigc++/adaptors/macros/bind.h.m4
+++ b/sigc++/adaptors/macros/bind.h.m4
@@ -177,28 +177,6 @@ ifelse($1,CALL_SIZE,[#endif // DOXYGEN_SHOULD_SKIP_THIS
 
 ])dnl end BIND_FUNCTOR_COUNT
 
-define([BIND_COUNT],[dnl
-/** Creates an adaptor of type sigc::bind_functor which fixes the last $1 argument(s) of the passed functor.
- * This function overload fixes the last $1 argument(s) of @e _A_func.
- *
- * @param _A_func Functor that should be wrapped.dnl
-FOR(1,$1,[
- * @param _A_b%1 Argument to bind to @e _A_func.])
- * @return Adaptor that executes _A_func with the bound argument on invokation.
- *
- * @ingroup bind
- */
-template <LIST(class T_functor, LOOP(class T_type%1, $1))>
-inline decltype(auto)
-bind(const T_functor& _A_func, LOOP(T_type%1 _A_b%1, $1))
-{ return bind_functor<-1, T_functor,dnl
-FOR(1,eval($1-1),[
-                    T_type%1,])
-                    T_type$1>
-                    (_A_func, LOOP(_A_b%1, $1));
-}
-
-])
 
 divert(0)dnl
 _FIREWALL([ADAPTORS_BIND])
@@ -377,7 +355,23 @@ bind(const T_functor& _A_func, T_bound1 _A_b1)
            (_A_func, _A_b1);
 }
 
-FOR(1,CALL_SIZE,[[BIND_COUNT(%1)]])dnl
+
+
+/** Creates an adaptor of type sigc::bind_functor which fixes the last 2 argument(s) of the passed functor.
+ * This function overload fixes the last 2 argument(s) of @e _A_func.
+ *
+ * @param _A_func Functor that should be wrapped.
+ * @param _A_b Arguments to bind to @e _A_func.
+ * @return Adaptor that executes _A_func with the bound argument on invokation.
+ *
+ * @ingroup bind
+ */
+template <class T_functor, class... T_type>
+inline decltype(auto)
+bind(const T_functor& _A_func, T_type... _A_b)
+{ return bind_functor<-1, T_functor, T_type...>(_A_func, _A_b...);
+}
+
 
 } /* namespace sigc */
 


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