@@ -119,6 +119,53 @@ namespace details
119119 }
120120 };
121121
122+ template <typename RET_TYPE=void >
123+ class functor_zero
124+ {
125+ private:
126+ typedef RET_TYPE (*static_function)();
127+ typedef RET_TYPE (*void_static_function)();
128+ typedef RET_TYPE (generic_class::*generic_mem)();
129+ typedef binder<generic_mem,
130+ static_function, void_static_function> binder_type;
131+ binder_type _binder;
132+
133+ RET_TYPE exec_static () const
134+ {
135+ return (*(_binder.get_static_func ()))();
136+ }
137+
138+ functor_zero& operator =(const functor_zero&)
139+ {
140+ return *this ;
141+ }
142+ public:
143+ typedef functor_zero type;
144+ functor_zero () { }
145+
146+ template <typename X, typename Y>
147+ functor_zero (Y* pmem, RET_TYPE(X::*func)()):
148+ _binder (reinterpret_cast <X*>(pmem), func)
149+ {
150+ }
151+
152+ template <typename X, typename Y>
153+ functor_zero (Y* pmem, RET_TYPE(X::*func)() const ):
154+ _binder (reinterpret_cast <X*>(pmem), func)
155+ {
156+ }
157+
158+ functor_zero (RET_TYPE(*func)() ):
159+ _binder (this , &functor_zero::exec_static, func)
160+ {
161+ }
162+
163+ RET_TYPE operator () () const
164+ {
165+ return (_binder.exec ()->*(_binder.get_mem_ptr ()))();
166+ }
167+ };
168+
122169 template <typename PAR1, typename RET_TYPE=void >
123170 class functor_one
124171 {
@@ -149,6 +196,12 @@ namespace details
149196 {
150197 }
151198
199+ template <typename X, typename Y>
200+ functor_one (Y* pmem, RET_TYPE(X::*func)(PAR1 p1) const ):
201+ _binder (reinterpret_cast <X*>(pmem), func)
202+ {
203+ }
204+
152205 functor_one (RET_TYPE(*func)(PAR1 p1) ):
153206 _binder (this , &functor_one::exec_static, func)
154207 {
@@ -189,11 +242,18 @@ namespace details
189242 {
190243 }
191244
245+ template <typename X, typename Y>
246+ functor_two (Y* pmem, RET_TYPE(X::*func)(PAR1 p1, PAR2 p2) const ):
247+ _binder (reinterpret_cast <X*>(pmem), func)
248+ {
249+ }
250+
192251 template <typename X, typename Y>
193252 functor_two (Y* pmem, RET_TYPE(X::*func)(PAR1 p1, PAR2 p2) ):
194253 _binder (reinterpret_cast <X*>(pmem), func)
195254 {
196255 }
256+
197257 functor_two (RET_TYPE(*func)(PAR1 p1, PAR2 p2) ):
198258 _binder (this , &functor_two::exec_static, func)
199259 {
@@ -204,6 +264,110 @@ namespace details
204264 return (_binder.exec ()->*(_binder.get_mem_ptr ()))(p1, p2);
205265 }
206266 };
267+
268+ template <typename PAR1, typename PAR2, typename PAR3, typename RET_TYPE=void >
269+ class functor_three
270+ {
271+ private:
272+ typedef RET_TYPE (*static_function)(PAR1 p1, PAR2 p2, PAR3 p3);
273+ typedef RET_TYPE (*void_static_function)(PAR1 p1, PAR2 p2, PAR3 p3);
274+
275+ typedef RET_TYPE
276+ (generic_class::*generic_mem)(PAR1 p1, PAR2 p2, PAR3 p3);
277+
278+ typedef binder<
279+ generic_mem, static_function, void_static_function
280+ > binder_type;
281+
282+ binder_type _binder;
283+
284+ RET_TYPE exec_static (PAR1 p1, PAR2 p2, PAR3 p3) const
285+ {
286+ return (*(_binder.get_static_func ()))(p1, p2, p3);
287+ }
288+ public:
289+ typedef functor_three type;
290+ functor_three () { }
291+
292+ functor_three (const functor_three& o):
293+ _binder (o._binder)
294+ {
295+ }
296+
297+ template <typename X, typename Y>
298+ functor_three (Y* pmem, RET_TYPE(X::*func)(PAR1 p1, PAR2 p2, PAR3 p3) const ):
299+ _binder (reinterpret_cast <X*>(pmem), func)
300+ {
301+ }
302+
303+ template <typename X, typename Y>
304+ functor_three (Y* pmem, RET_TYPE(X::*func)(PAR1 p1, PAR2 p2, PAR3 p3) ):
305+ _binder (reinterpret_cast <X*>(pmem), func)
306+ {
307+ }
308+
309+ functor_three (RET_TYPE(*func)(PAR1 p1, PAR2 p2, PAR3 p3) ):
310+ _binder (this , &functor_three::exec_static, func)
311+ {
312+ }
313+
314+ RET_TYPE operator () (PAR1 p1, PAR2 p2, PAR3 p3) const
315+ {
316+ return (_binder.exec ()->*(_binder.get_mem_ptr ()))(p1, p2, p3);
317+ }
318+ };
319+
320+ template <typename PAR1, typename PAR2, typename PAR3, typename PAR4, typename RET_TYPE=void >
321+ class functor_four
322+ {
323+ private:
324+ typedef RET_TYPE (*static_function)(PAR1 p1, PAR2 p2, PAR3 p3, PAR4 p4);
325+ typedef RET_TYPE (*void_static_function)(PAR1 p1, PAR2 p2, PAR3 p3, PAR4 p4);
326+
327+ typedef RET_TYPE
328+ (generic_class::*generic_mem)(PAR1 p1, PAR2 p2, PAR3 p3, PAR4 p4);
329+
330+ typedef binder<
331+ generic_mem, static_function, void_static_function
332+ > binder_type;
333+
334+ binder_type _binder;
335+
336+ RET_TYPE exec_static (PAR1 p1, PAR2 p2, PAR3 p3, PAR4 p4) const
337+ {
338+ return (*(_binder.get_static_func ()))(p1, p2, p3, p4);
339+ }
340+ public:
341+ typedef functor_four type;
342+ functor_four () { }
343+
344+ functor_four (const functor_four& o):
345+ _binder (o._binder)
346+ {
347+ }
348+
349+ template <typename X, typename Y>
350+ functor_four (Y* pmem, RET_TYPE(X::*func)(PAR1 p1, PAR2 p2, PAR3 p3, PAR4 p4) const ):
351+ _binder (reinterpret_cast <X*>(pmem), func)
352+ {
353+ }
354+
355+ template <typename X, typename Y>
356+ functor_four (Y* pmem, RET_TYPE(X::*func)(PAR1 p1, PAR2 p2, PAR3 p3, PAR4 p4) ):
357+ _binder (reinterpret_cast <X*>(pmem), func)
358+ {
359+ }
360+
361+ functor_four (RET_TYPE(*func)(PAR1 p1, PAR2 p2, PAR3 p3, PAR4 p4) ):
362+ _binder (this , &functor_four::exec_static, func)
363+ {
364+ }
365+
366+ RET_TYPE operator () (PAR1 p1, PAR2 p2, PAR3 p3, PAR4 p4) const
367+ {
368+ return (_binder.exec ()->*(_binder.get_mem_ptr ()))(p1, p2, p3, p4);
369+ }
370+ };
207371 }
208372}}
209373
0 commit comments