]> git.tdb.fi Git - ext/sigc++-2.0.git/blob - sigc++/adaptors/lambda/macros/select.h.m4
Import libsigc++ 2.10.8 sources
[ext/sigc++-2.0.git] / sigc++ / adaptors / lambda / macros / select.h.m4
1 dnl Copyright 2002, The libsigc++ Development Team 
2 dnl 
3 dnl This library is free software; you can redistribute it and/or 
4 dnl modify it under the terms of the GNU Lesser General Public 
5 dnl License as published by the Free Software Foundation; either 
6 dnl version 2.1 of the License, or (at your option) any later version. 
7 dnl 
8 dnl This library is distributed in the hope that it will be useful, 
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
11 dnl Lesser General Public License for more details. 
12 dnl 
13 dnl You should have received a copy of the GNU Lesser General Public 
14 dnl License along with this library; if not, write to the Free Software 
15 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 dnl
17 divert(-1)
18 include(template.macros.m4)
19
20 dnl
21 dnl Macros to make select arguments
22 define([LAMBDA_SELECT_DO],[dnl
23   template <LOOP(class T_arg%1, $2)>
24 dnl T_arg$1 operator ()(LOOP(T_arg%1 _A_%1, $2)) const { return _A_$1; }
25   T_arg$1 operator ()(LIST(FOR(1,eval($1-1),[T_arg%1,]),T_arg$1 _A_$1,FOR(eval($1+1),$2,[T_arg%1,]))) const { return _A_$1; }
26
27   #ifndef SIGC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD
28   template <LOOP(class T_arg%1, $2)>
29   //Does not work: T_arg$1 sun_forte_workaround(LOOP(T_arg%1 _A_%1, $2)) const { return operator()( LOOP(_A_%1, $2) ); }
30   T_arg$1 sun_forte_workaround(LIST(FOR(1,eval($1-1),[T_arg%1,]),T_arg$1 _A_$1,FOR(eval($1+1),$2,[T_arg%1,]))) const { return _A_$1; }
31   #endif
32   
33 ])
34 define([LAMBDA_SELECT],[dnl
35 struct lambda_select$1 : public lambda_base
36 {
37   template <LOOP(class T_arg%1=void,$2)>
38   struct deduce_result_type
39     { typedef T_arg$1 type; };
40   typedef void result_type; // no operator ()() overload
41
42   void operator ()() const; // not implemented
43 FOR($1, $2,[[LAMBDA_SELECT_DO($1,%1)]])dnl
44 };
45
46 ])
47 define([LAMBDA_SELECTOR],[dnl
48 /** Lambda selector.
49  *
50  * @deprecated Use C++11 lambda expressions or %std::bind() instead of libsigc++ lambdas and sigc::group().
51  *
52  * @ingroup lambdas
53  */
54 extern SIGC_API const lambda<internal::lambda_select$1> _$1;
55
56 ])
57
58 divert(0)dnl
59 #ifndef _SIGC_LAMBDA_SELECT_HPP_
60 #define _SIGC_LAMBDA_SELECT_HPP_
61 #include <sigc++/adaptors/lambda/base.h>
62
63 _DEPRECATE_IFDEF_START
64
65 namespace sigc {
66
67 #ifndef DOXYGEN_SHOULD_SKIP_THIS
68 namespace internal {
69 FOR(1,CALL_SIZE,[[LAMBDA_SELECT(%1,CALL_SIZE)]])dnl
70 } /* namespace internal */
71
72 #endif // DOXYGEN_SHOULD_SKIP_THIS
73 } /* namespace sigc */
74
75 _DEPRECATE_IFDEF_END
76
77 #endif /* _SIGC_LAMBDA_SELECT_HPP_ */