[libsigc++2/variadic_bind2: 8/68] Remove (and replace) the _R_ and _P_ m4 macros.



commit f3ef6451b060c9416aa7016950327eeb42311ee8
Author: Murray Cumming <murrayc murrayc com>
Date:   Thu Jan 7 22:31:09 2016 +0100

    Remove (and replace) the _R_ and _P_ m4 macros.
    
    They just make it that little bit harder to convert the code to
    non-generated C++.

 sigc++/adaptors/macros/bind.h.m4   |   22 +++++++++++-----------
 sigc++/adaptors/macros/hide.h.m4   |   12 ++++++------
 sigc++/adaptors/macros/retype.h.m4 |    2 +-
 sigc++/functors/macros/slot.h.m4   |    6 +++---
 sigc++/macros/template.macros.m4   |    3 ---
 5 files changed, 21 insertions(+), 24 deletions(-)
---
diff --git a/sigc++/adaptors/macros/bind.h.m4 b/sigc++/adaptors/macros/bind.h.m4
index 495f7fb..c008f46 100644
--- a/sigc++/adaptors/macros/bind.h.m4
+++ b/sigc++/adaptors/macros/bind.h.m4
@@ -24,7 +24,7 @@ $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(_P_(T_arg%1), 
eval(CALL_SIZE-$2)), LOOP(_P_(typename unwrap_reference<T_type%1>::type), $1))>::type type; };
+    { 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
@@ -37,7 +37,7 @@ FOR(1, eval($2-1),[
   template <LOOP([class T_arg%1], eval($2-1))>
   typename deduce_result_type<LOOP(T_arg%1,eval($2-1))>::type
   operator()(LOOP(T_arg%1 _A_arg%1,eval($2-1)))
-    { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([_P_(T_arg%1)],eval($1-1)), 
_P_(typename unwrap_reference<T_bound>::type), FOR($1,eval($2-1),[_P_(T_arg%1),]))>
+    { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([type_trait_pass_t<T_arg%1>], 
eval($1-1)), type_trait_pass_t<typename unwrap_reference<T_bound>::type>, 
FOR($1,eval($2-1),[type_trait_pass_t<T_arg%1>,]))>
         (LIST(LOOP(_A_arg%1,eval($1-1)), bound_.invoke(), FOR($1,eval($2-1),[_A_arg%1,])));
     }
 
@@ -45,7 +45,7 @@ FOR(1, eval($2-1),[
   template <LOOP([class T_arg%1], eval($2-1))>
   typename deduce_result_type<LOOP(T_arg%1,eval($2-1))>::type
   sun_forte_workaround(LOOP(T_arg%1 _A_arg%1,eval($2-1)))
-    { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([_P_(T_arg%1)],eval($1-1)), 
_P_(typename unwrap_reference<T_bound>::type), FOR($1,eval($2-1),[_P_(T_arg%1),]))>
+    { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([type_trait_pass_t<T_arg%1>], 
eval($1-1)), type_trait_pass_t<typename unwrap_reference<T_bound>::type>, 
FOR($1,eval($2-1),[type_trait_pass_t<T_arg%1>,]))>
         (LIST(LOOP(_A_arg%1,eval($1-1)), bound_.invoke(), FOR($1,eval($2-1),[_A_arg%1,])));
     }
   #endif
@@ -62,7 +62,7 @@ FOR(1, eval($2-1),[
   template <LOOP([class T_arg%1], eval($2-1))>
   typename deduce_result_type<LOOP(T_arg%1,eval($2-1))>::type
   operator()(LOOP(T_arg%1 _A_arg%1, eval($2-1)))
-    { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([_P_(T_arg%1)],eval($2-1)), 
LOOP(_P_(typename unwrap_reference<T_type%1>::type), $1))>
+    { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([type_trait_pass_t<T_arg%1>], 
eval($2-1)), LOOP(type_trait_pass_t<typename unwrap_reference<T_type%1>::type>, $1))>
         (LIST(LOOP(_A_arg%1,eval($2-1)), LOOP(bound%1_.invoke(), $1)));
     }
 
@@ -70,7 +70,7 @@ FOR(1, eval($2-1),[
   template <LOOP([class T_arg%1], eval($2-1))>
   typename deduce_result_type<LOOP(T_arg%1,eval($2-1))>::type
   sun_forte_workaround(LOOP(T_arg%1 _A_arg%1, eval($2-1)))
-    { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([_P_(T_arg%1)],eval($2-1)), 
LOOP(_P_(typename unwrap_reference<T_type%1>::type), $1))>
+    { return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LIST(LOOP([type_trait_pass_t<T_arg%1>], 
eval($2-1)), LOOP(type_trait_pass_t<typename unwrap_reference<T_type%1>::type>, $1))>
         (LIST(LOOP(_A_arg%1,eval($2-1)), LOOP(bound%1_.invoke(), $1)));
     }
   #endif
@@ -93,7 +93,7 @@ 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(_P_(T_arg%1),eval($1)), 
_P_(typename unwrap_reference<T_bound>::type), FOR(eval($1+1),eval(CALL_SIZE-1),[_P_(T_arg%1),]))>::type 
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;
@@ -105,7 +105,7 @@ ifelse($1,0,[#endif
   operator()()
   {
     //Note: The AIX compiler sometimes gives linker errors if we do not define this in the class.
-    return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<_P_(typename 
unwrap_reference<T_bound>::type)> (bound_.invoke());
+    return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<type_trait_pass_t<typename 
unwrap_reference<T_bound>::type>> (bound_.invoke());
   }
 
 FOR(eval($1+1),CALL_SIZE,[[BIND_OPERATOR_LOCATION(eval($1+1),%1)]])dnl
@@ -113,7 +113,7 @@ FOR(eval($1+1),CALL_SIZE,[[BIND_OPERATOR_LOCATION(eval($1+1),%1)]])dnl
    * @param _A_func Functor to invoke from operator()().
    * @param _A_bound Argument to bind to the functor.
    */
-  bind_functor(_R_(T_functor) _A_func, _R_(T_bound) _A_bound)
+  bind_functor(type_trait_take_t<T_functor> _A_func, type_trait_take_t<T_bound> _A_bound)
     : adapts<T_functor>(_A_func), bound_(_A_bound)
     {}
 
@@ -140,7 +140,7 @@ 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(_P_(T_arg%1), 
eval(CALL_SIZE-$1)), LOOP(_P_(typename unwrap_reference<T_type%1>::type), $1))>::type type; };
+    { 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))>
@@ -159,7 +159,7 @@ ifelse($1,1,[#endif // DOXYGEN_SHOULD_SKIP_THIS
   operator()()
   {
     //Note: The AIX compiler sometimes gives linker errors if we do not define this in the class.
-    return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LOOP(_P_(typename 
unwrap_reference<T_type%1>::type), $1)> (LOOP(bound%1_.invoke(), $1));
+    return this->functor_.SIGC_WORKAROUND_OPERATOR_PARENTHESES<LOOP(type_trait_pass_t<typename 
unwrap_reference<T_type%1>::type>, $1)> (LOOP(bound%1_.invoke(), $1));
   }
 
 FOR(2,eval(CALL_SIZE-$1+1),[[BIND_OPERATOR_COUNT($1,%1)]])dnl
@@ -168,7 +168,7 @@ FOR(2,eval(CALL_SIZE-$1+1),[[BIND_OPERATOR_COUNT($1,%1)]])dnl
 FOR(1,$1,[
    * @param _A_bound%1 Argument to bind to the functor.])
    */
-  bind_functor(_R_(T_functor) _A_func, LOOP(_R_(T_type%1) _A_bound%1, $1))
+  bind_functor(type_trait_take_t<T_functor> _A_func, LOOP(type_trait_take_t<T_type%1> _A_bound%1, $1))
     : adapts<T_functor>(_A_func), LOOP(bound%1_(_A_bound%1), $1)
     {}
 
diff --git a/sigc++/adaptors/macros/hide.h.m4 b/sigc++/adaptors/macros/hide.h.m4
index 6bdc199..9aba9db 100644
--- a/sigc++/adaptors/macros/hide.h.m4
+++ b/sigc++/adaptors/macros/hide.h.m4
@@ -27,9 +27,9 @@ ifelse(eval($1 < 2),1,[#ifndef DOXYGEN_SHOULD_SKIP_THIS
   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(_P_(T_arg%1),eval($2-1))>::type type; 
};
+    { 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(_P_(T_arg%1),eval($1-1)), 
FOR(eval($1+1),$2,[_P_(T_arg%1),]))>::type type; };
+    { 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
@@ -63,14 +63,14 @@ FOR(1, eval($2-1),[
   template <LOOP([class T_arg%1], $2)>
   typename deduce_result_type<LOOP(T_arg%1, $2)>::type
   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),[_P_(T_arg%1),]))>
+    { 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
   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),[_P_(T_arg%1),]))>
+    { 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,]))); }
   #endif
 
@@ -86,14 +86,14 @@ FOR(eval($1+1), $2,[
   template <LOOP([class T_arg%1], $2)>
   typename deduce_result_type<LOOP(T_arg%1, $2)>::type
   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),[_P_(T_arg%1),]),FOR(eval($1+1), 
$2,[_P_(T_arg%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
   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),[_P_(T_arg%1),]),FOR(eval($1+1), 
$2,[_P_(T_arg%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,]))); }
   #endif
 
diff --git a/sigc++/adaptors/macros/retype.h.m4 b/sigc++/adaptors/macros/retype.h.m4
index b35edfe..20970d7 100644
--- a/sigc++/adaptors/macros/retype.h.m4
+++ b/sigc++/adaptors/macros/retype.h.m4
@@ -135,7 +135,7 @@ struct retype_functor
 #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(_P_(T_arg%1),CALL_SIZE)>::type 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;
 
diff --git a/sigc++/functors/macros/slot.h.m4 b/sigc++/functors/macros/slot.h.m4
index 5c6436c..7d28254 100644
--- a/sigc++/functors/macros/slot.h.m4
+++ b/sigc++/functors/macros/slot.h.m4
@@ -45,7 +45,7 @@ class slot$1
 {
 public:
   typedef T_return result_type;
-FOR(1, $1,[  typedef _R_(T_arg%1) arg%1_type_;
+FOR(1, $1,[  typedef type_trait_take_t<T_arg%1> arg%1_type_;
 ])
 
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
@@ -327,14 +327,14 @@ FOR(1, $1,[
    * @param _A_a%1 Argument to be passed on to the functor.])
    * @return The return values of the functor invocation.
    */
-  static T_return call_it(LIST(slot_rep* rep, LOOP(_R_(T_arg%1) a_%1, $1)))
+  static T_return call_it(LIST(slot_rep* rep, LOOP(type_trait_take_t<T_arg%1> a_%1, $1)))
     {
       typedef typed_slot_rep<T_functor> typed_slot;
       typed_slot *typed_rep = static_cast<typed_slot*>(rep);dnl
 ifelse($1,0,[
       return (typed_rep->functor_)();
 ],[
-      return (typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<LOOP([_R_(T_arg%1)],$1)>
+      return 
(typed_rep->functor_).SIGC_WORKAROUND_OPERATOR_PARENTHESES<LOOP([type_trait_take_t<T_arg%1>],$1)>
                (LOOP(a_%1, $1));
 ])dnl
     }
diff --git a/sigc++/macros/template.macros.m4 b/sigc++/macros/template.macros.m4
index 58fb5ab..c983a68 100644
--- a/sigc++/macros/template.macros.m4
+++ b/sigc++/macros/template.macros.m4
@@ -39,9 +39,6 @@ divert(1)dnl
 divert(0)dnl
 ])
 
-define([_R_],[type_trait_take_t<$1>])
-define([_P_],[type_trait_pass_t<$1>])
-
 define([__DEPRECATION_GUARD__],[SIGCXX_DISABLE_DEPRECATED])dnl
 dnl Start deprecation
 define([_DEPRECATE_IFDEF_START],[dnl


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