CppUnit project page CppUnit home page

functor.h

Go to the documentation of this file.
00001 // This script is generated by the python script functor.py
00002 // Do not edit.
00003 #ifndef CPPTL_FUNCTOR_H_INCLUDED
00004 # define CPPTL_FUNCTOR_H_INCLUDED
00005 
00006 # include <cpptl/config.h>
00007 
00008 namespace CppTL {
00009 
00010 // Partially borrowed from the standard
00011 // See: 
00012 // N1453: http://std.dkuug.dk/jtc1/sc22/wg21/docs/papers/2003/n1453.html
00013 template<class T>
00014 class ReferenceWrapper
00015 {
00016 public:
00017   explicit ReferenceWrapper( T &t ) : t_( &t )
00018   {
00019   }
00020 
00021   operator T&() const
00022   {
00023      return *t_;
00024   }
00025 
00026 private:
00027   T *t_;
00028 };
00029 
00030 template<class T>
00031 inline ReferenceWrapper<T> 
00032 ref( T &t )
00033 {
00034   return ReferenceWrapper<T>( t );
00035 }
00036 
00037 template<class T>
00038 inline ReferenceWrapper<const T>
00039 cref( const T& t )
00040 {
00041   return ReferenceWrapper<const T>( t );
00042 }
00043 
00044 
00046 namespace Impl {
00047 
00048    class FunctorBase
00049    {
00050    public:
00051       virtual ~FunctorBase()
00052       {
00053       }
00054 
00055       virtual FunctorBase *clone() const = 0;
00056    };
00057 
00058    
00059    class FunctorBase0 : public FunctorBase
00060    {
00061    public:
00062       virtual void operator()(  ) const = 0;
00063    };
00064 
00065    
00066    template< class Functor >
00067    class GenericFunctor0 : public FunctorBase0
00068    {
00069    public:
00070       typedef GenericFunctor0< Functor > SelfType;
00071 
00072       GenericFunctor0( const Functor &functor )
00073          : functor_( functor )
00074       {
00075       }
00076 
00077       void operator()(  ) const
00078       {
00079          functor_(  );
00080       }
00081 
00082       FunctorBase *clone() const
00083       {
00084          return new SelfType( *this );
00085       }
00086 
00087    private:
00088       Functor functor_;
00089    };
00090 
00091    
00092    template< class Holder, class Object >
00093    class MemberFunctor0 : public FunctorBase0
00094    {
00095    public:
00096       typedef MemberFunctor0< Holder, Object > SelfType;
00097       typedef void (Object::*MemberFn)(  );
00098 
00099       MemberFunctor0( const Holder &holder, MemberFn member )
00100          : holder_( holder )
00101          , member_( member )
00102       {
00103       }
00104 
00105       void operator()(  ) const
00106       {
00107          Object &object = *holder_;
00108          (object.*member_)(  );
00109       }
00110 
00111       FunctorBase *clone() const
00112       {
00113          return new SelfType( *this );
00114       }
00115 
00116    private:
00117       Holder holder_;
00118       MemberFn member_;
00119    };
00120 
00121    
00122    template< class Functor, class BindArg >
00123    class Bind0
00124    {
00125    public:
00126    typedef void result_type;
00127 
00128 
00129       Bind0( Functor functor, BindArg arg )
00130          : functor_( functor )
00131          , arg_( arg )
00132       {
00133       }
00134 
00135       result_type operator()(  ) const
00136       {
00137          functor_( arg_ );
00138       }
00139    private:
00140       Functor functor_;
00141       BindArg arg_;
00142    };
00143 
00144 
00145    
00146    template< class Return >
00147    class FunctorBase0R : public FunctorBase
00148    {
00149    public:
00150       virtual Return operator()(  ) const = 0;
00151    };
00152 
00153    
00154    template< class Functor, class Return >
00155    class GenericFunctor0R : public FunctorBase0R< Return >
00156    {
00157    public:
00158       typedef GenericFunctor0R< Functor, Return > SelfType;
00159 
00160       GenericFunctor0R( const Functor &functor )
00161          : functor_( functor )
00162       {
00163       }
00164 
00165       Return operator()(  ) const
00166       {
00167          return functor_(  );
00168       }
00169 
00170       FunctorBase *clone() const
00171       {
00172          return new SelfType( *this );
00173       }
00174 
00175    private:
00176       Functor functor_;
00177    };
00178 
00179    
00180    template< class Holder, class Object, class Return >
00181    class MemberFunctor0R : public FunctorBase0R< Return >
00182    {
00183    public:
00184       typedef MemberFunctor0R< Holder, Object, Return > SelfType;
00185       typedef Return (Object::*MemberFn)(  );
00186 
00187       MemberFunctor0R( const Holder &holder, MemberFn member )
00188          : holder_( holder )
00189          , member_( member )
00190       {
00191       }
00192 
00193       Return operator()(  ) const
00194       {
00195          Object &object = *holder_;
00196          return (object.*member_)(  );
00197       }
00198 
00199       FunctorBase *clone() const
00200       {
00201          return new SelfType( *this );
00202       }
00203 
00204    private:
00205       Holder holder_;
00206       MemberFn member_;
00207    };
00208 
00209    
00210    template< class Functor, class Return, class BindArg >
00211    class Bind0R
00212    {
00213    public:
00214    typedef Return result_type;
00215 
00216 
00217       Bind0R( Functor functor, BindArg arg )
00218          : functor_( functor )
00219          , arg_( arg )
00220       {
00221       }
00222 
00223       result_type operator()(  ) const
00224       {
00225          return functor_( arg_ );
00226       }
00227    private:
00228       Functor functor_;
00229       BindArg arg_;
00230    };
00231 
00232 
00233    
00234    template< class Arg1 >
00235    class FunctorBase1 : public FunctorBase
00236    {
00237    public:
00238       virtual void operator()( Arg1 a1 ) const = 0;
00239    };
00240 
00241    
00242    template< class Functor, class Arg1 >
00243    class GenericFunctor1 : public FunctorBase1< Arg1 >
00244    {
00245    public:
00246       typedef GenericFunctor1< Functor, Arg1 > SelfType;
00247 
00248       GenericFunctor1( const Functor &functor )
00249          : functor_( functor )
00250       {
00251       }
00252 
00253       void operator()( Arg1 a1 ) const
00254       {
00255          functor_( a1 );
00256       }
00257 
00258       FunctorBase *clone() const
00259       {
00260          return new SelfType( *this );
00261       }
00262 
00263    private:
00264       Functor functor_;
00265    };
00266 
00267    
00268    template< class Holder, class Object, class Arg1 >
00269    class MemberFunctor1 : public FunctorBase1< Arg1 >
00270    {
00271    public:
00272       typedef MemberFunctor1< Holder, Object, Arg1 > SelfType;
00273       typedef void (Object::*MemberFn)( Arg1 a1 );
00274 
00275       MemberFunctor1( const Holder &holder, MemberFn member )
00276          : holder_( holder )
00277          , member_( member )
00278       {
00279       }
00280 
00281       void operator()( Arg1 a1 ) const
00282       {
00283          Object &object = *holder_;
00284          (object.*member_)( a1 );
00285       }
00286 
00287       FunctorBase *clone() const
00288       {
00289          return new SelfType( *this );
00290       }
00291 
00292    private:
00293       Holder holder_;
00294       MemberFn member_;
00295    };
00296 
00297    
00298    template< class Functor, class Arg1, class BindArg >
00299    class Bind1
00300    {
00301    public:
00302    typedef void result_type;
00303    typedef Arg1 arg1_type;
00304    typedef Arg1 first_argument_type;
00305 
00306 
00307       Bind1( Functor functor, BindArg arg )
00308          : functor_( functor )
00309          , arg_( arg )
00310       {
00311       }
00312 
00313       result_type operator()( Arg1 a1 ) const
00314       {
00315          functor_( a1, arg_ );
00316       }
00317    private:
00318       Functor functor_;
00319       BindArg arg_;
00320    };
00321 
00322 
00323    
00324    template< class Return, class Arg1 >
00325    class FunctorBase1R : public FunctorBase
00326    {
00327    public:
00328       virtual Return operator()( Arg1 a1 ) const = 0;
00329    };
00330 
00331    
00332    template< class Functor, class Return, class Arg1 >
00333    class GenericFunctor1R : public FunctorBase1R< Return, Arg1 >
00334    {
00335    public:
00336       typedef GenericFunctor1R< Functor, Return, Arg1 > SelfType;
00337 
00338       GenericFunctor1R( const Functor &functor )
00339          : functor_( functor )
00340       {
00341       }
00342 
00343       Return operator()( Arg1 a1 ) const
00344       {
00345          return functor_( a1 );
00346       }
00347 
00348       FunctorBase *clone() const
00349       {
00350          return new SelfType( *this );
00351       }
00352 
00353    private:
00354       Functor functor_;
00355    };
00356 
00357    
00358    template< class Holder, class Object, class Return, class Arg1 >
00359    class MemberFunctor1R : public FunctorBase1R< Return, Arg1 >
00360    {
00361    public:
00362       typedef MemberFunctor1R< Holder, Object, Return, Arg1 > SelfType;
00363       typedef Return (Object::*MemberFn)( Arg1 a1 );
00364 
00365       MemberFunctor1R( const Holder &holder, MemberFn member )
00366          : holder_( holder )
00367          , member_( member )
00368       {
00369       }
00370 
00371       Return operator()( Arg1 a1 ) const
00372       {
00373          Object &object = *holder_;
00374          return (object.*member_)( a1 );
00375       }
00376 
00377       FunctorBase *clone() const
00378       {
00379          return new SelfType( *this );
00380       }
00381 
00382    private:
00383       Holder holder_;
00384       MemberFn member_;
00385    };
00386 
00387    
00388    template< class Functor, class Return, class Arg1, class BindArg >
00389    class Bind1R
00390    {
00391    public:
00392    typedef Return result_type;
00393    typedef Arg1 arg1_type;
00394    typedef Arg1 first_argument_type;
00395 
00396 
00397       Bind1R( Functor functor, BindArg arg )
00398          : functor_( functor )
00399          , arg_( arg )
00400       {
00401       }
00402 
00403       result_type operator()( Arg1 a1 ) const
00404       {
00405          return functor_( a1, arg_ );
00406       }
00407    private:
00408       Functor functor_;
00409       BindArg arg_;
00410    };
00411 
00412 
00413    
00414    template< class Arg1, class Arg2 >
00415    class FunctorBase2 : public FunctorBase
00416    {
00417    public:
00418       virtual void operator()( Arg1 a1, Arg2 a2 ) const = 0;
00419    };
00420 
00421    
00422    template< class Functor, class Arg1, class Arg2 >
00423    class GenericFunctor2 : public FunctorBase2< Arg1, Arg2 >
00424    {
00425    public:
00426       typedef GenericFunctor2< Functor, Arg1, Arg2 > SelfType;
00427 
00428       GenericFunctor2( const Functor &functor )
00429          : functor_( functor )
00430       {
00431       }
00432 
00433       void operator()( Arg1 a1, Arg2 a2 ) const
00434       {
00435          functor_( a1, a2 );
00436       }
00437 
00438       FunctorBase *clone() const
00439       {
00440          return new SelfType( *this );
00441       }
00442 
00443    private:
00444       Functor functor_;
00445    };
00446 
00447    
00448    template< class Holder, class Object, class Arg1, class Arg2 >
00449    class MemberFunctor2 : public FunctorBase2< Arg1, Arg2 >
00450    {
00451    public:
00452       typedef MemberFunctor2< Holder, Object, Arg1, Arg2 > SelfType;
00453       typedef void (Object::*MemberFn)( Arg1 a1, Arg2 a2 );
00454 
00455       MemberFunctor2( const Holder &holder, MemberFn member )
00456          : holder_( holder )
00457          , member_( member )
00458       {
00459       }
00460 
00461       void operator()( Arg1 a1, Arg2 a2 ) const
00462       {
00463          Object &object = *holder_;
00464          (object.*member_)( a1, a2 );
00465       }
00466 
00467       FunctorBase *clone() const
00468       {
00469          return new SelfType( *this );
00470       }
00471 
00472    private:
00473       Holder holder_;
00474       MemberFn member_;
00475    };
00476 
00477    
00478    template< class Functor, class Arg1, class Arg2, class BindArg >
00479    class Bind2
00480    {
00481    public:
00482    typedef void result_type;
00483    typedef Arg1 arg1_type;
00484    typedef Arg1 first_argument_type;
00485    typedef Arg2 arg2_type;
00486    typedef Arg2 second_argument_type;
00487 
00488 
00489       Bind2( Functor functor, BindArg arg )
00490          : functor_( functor )
00491          , arg_( arg )
00492       {
00493       }
00494 
00495       result_type operator()( Arg1 a1, Arg2 a2 ) const
00496       {
00497          functor_( a1, a2, arg_ );
00498       }
00499    private:
00500       Functor functor_;
00501       BindArg arg_;
00502    };
00503 
00504 
00505    
00506    template< class Return, class Arg1, class Arg2 >
00507    class FunctorBase2R : public FunctorBase
00508    {
00509    public:
00510       virtual Return operator()( Arg1 a1, Arg2 a2 ) const = 0;
00511    };
00512 
00513    
00514    template< class Functor, class Return, class Arg1, class Arg2 >
00515    class GenericFunctor2R : public FunctorBase2R< Return, Arg1, Arg2 >
00516    {
00517    public:
00518       typedef GenericFunctor2R< Functor, Return, Arg1, Arg2 > SelfType;
00519 
00520       GenericFunctor2R( const Functor &functor )
00521          : functor_( functor )
00522       {
00523       }
00524 
00525       Return operator()( Arg1 a1, Arg2 a2 ) const
00526       {
00527          return functor_( a1, a2 );
00528       }
00529 
00530       FunctorBase *clone() const
00531       {
00532          return new SelfType( *this );
00533       }
00534 
00535    private:
00536       Functor functor_;
00537    };
00538 
00539    
00540    template< class Holder, class Object, class Return, class Arg1, class Arg2 >
00541    class MemberFunctor2R : public FunctorBase2R< Return, Arg1, Arg2 >
00542    {
00543    public:
00544       typedef MemberFunctor2R< Holder, Object, Return, Arg1, Arg2 > SelfType;
00545       typedef Return (Object::*MemberFn)( Arg1 a1, Arg2 a2 );
00546 
00547       MemberFunctor2R( const Holder &holder, MemberFn member )
00548          : holder_( holder )
00549          , member_( member )
00550       {
00551       }
00552 
00553       Return operator()( Arg1 a1, Arg2 a2 ) const
00554       {
00555          Object &object = *holder_;
00556          return (object.*member_)( a1, a2 );
00557       }
00558 
00559       FunctorBase *clone() const
00560       {
00561          return new SelfType( *this );
00562       }
00563 
00564    private:
00565       Holder holder_;
00566       MemberFn member_;
00567    };
00568 
00569    
00570    template< class Functor, class Return, class Arg1, class Arg2, class BindArg >
00571    class Bind2R
00572    {
00573    public:
00574    typedef Return result_type;
00575    typedef Arg1 arg1_type;
00576    typedef Arg1 first_argument_type;
00577    typedef Arg2 arg2_type;
00578    typedef Arg2 second_argument_type;
00579 
00580 
00581       Bind2R( Functor functor, BindArg arg )
00582          : functor_( functor )
00583          , arg_( arg )
00584       {
00585       }
00586 
00587       result_type operator()( Arg1 a1, Arg2 a2 ) const
00588       {
00589          return functor_( a1, a2, arg_ );
00590       }
00591    private:
00592       Functor functor_;
00593       BindArg arg_;
00594    };
00595 
00596 
00597    
00598    template< class Arg1, class Arg2, class Arg3 >
00599    class FunctorBase3 : public FunctorBase
00600    {
00601    public:
00602       virtual void operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const = 0;
00603    };
00604 
00605    
00606    template< class Functor, class Arg1, class Arg2, class Arg3 >
00607    class GenericFunctor3 : public FunctorBase3< Arg1, Arg2, Arg3 >
00608    {
00609    public:
00610       typedef GenericFunctor3< Functor, Arg1, Arg2, Arg3 > SelfType;
00611 
00612       GenericFunctor3( const Functor &functor )
00613          : functor_( functor )
00614       {
00615       }
00616 
00617       void operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const
00618       {
00619          functor_( a1, a2, a3 );
00620       }
00621 
00622       FunctorBase *clone() const
00623       {
00624          return new SelfType( *this );
00625       }
00626 
00627    private:
00628       Functor functor_;
00629    };
00630 
00631    
00632    template< class Holder, class Object, class Arg1, class Arg2, class Arg3 >
00633    class MemberFunctor3 : public FunctorBase3< Arg1, Arg2, Arg3 >
00634    {
00635    public:
00636       typedef MemberFunctor3< Holder, Object, Arg1, Arg2, Arg3 > SelfType;
00637       typedef void (Object::*MemberFn)( Arg1 a1, Arg2 a2, Arg3 a3 );
00638 
00639       MemberFunctor3( const Holder &holder, MemberFn member )
00640          : holder_( holder )
00641          , member_( member )
00642       {
00643       }
00644 
00645       void operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const
00646       {
00647          Object &object = *holder_;
00648          (object.*member_)( a1, a2, a3 );
00649       }
00650 
00651       FunctorBase *clone() const
00652       {
00653          return new SelfType( *this );
00654       }
00655 
00656    private:
00657       Holder holder_;
00658       MemberFn member_;
00659    };
00660 
00661    
00662    template< class Functor, class Arg1, class Arg2, class Arg3, class BindArg >
00663    class Bind3
00664    {
00665    public:
00666    typedef void result_type;
00667    typedef Arg1 arg1_type;
00668    typedef Arg1 first_argument_type;
00669    typedef Arg2 arg2_type;
00670    typedef Arg2 second_argument_type;
00671    typedef Arg3 arg3_type;
00672 
00673 
00674       Bind3( Functor functor, BindArg arg )
00675          : functor_( functor )
00676          , arg_( arg )
00677       {
00678       }
00679 
00680       result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const
00681       {
00682          functor_( a1, a2, a3, arg_ );
00683       }
00684    private:
00685       Functor functor_;
00686       BindArg arg_;
00687    };
00688 
00689 
00690    
00691    template< class Return, class Arg1, class Arg2, class Arg3 >
00692    class FunctorBase3R : public FunctorBase
00693    {
00694    public:
00695       virtual Return operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const = 0;
00696    };
00697 
00698    
00699    template< class Functor, class Return, class Arg1, class Arg2, class Arg3 >
00700    class GenericFunctor3R : public FunctorBase3R< Return, Arg1, Arg2, Arg3 >
00701    {
00702    public:
00703       typedef GenericFunctor3R< Functor, Return, Arg1, Arg2, Arg3 > SelfType;
00704 
00705       GenericFunctor3R( const Functor &functor )
00706          : functor_( functor )
00707       {
00708       }
00709 
00710       Return operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const
00711       {
00712          return functor_( a1, a2, a3 );
00713       }
00714 
00715       FunctorBase *clone() const
00716       {
00717          return new SelfType( *this );
00718       }
00719 
00720    private:
00721       Functor functor_;
00722    };
00723 
00724    
00725    template< class Holder, class Object, class Return, class Arg1, class Arg2, class Arg3 >
00726    class MemberFunctor3R : public FunctorBase3R< Return, Arg1, Arg2, Arg3 >
00727    {
00728    public:
00729       typedef MemberFunctor3R< Holder, Object, Return, Arg1, Arg2, Arg3 > SelfType;
00730       typedef Return (Object::*MemberFn)( Arg1 a1, Arg2 a2, Arg3 a3 );
00731 
00732       MemberFunctor3R( const Holder &holder, MemberFn member )
00733          : holder_( holder )
00734          , member_( member )
00735       {
00736       }
00737 
00738       Return operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const
00739       {
00740          Object &object = *holder_;
00741          return (object.*member_)( a1, a2, a3 );
00742       }
00743 
00744       FunctorBase *clone() const
00745       {
00746          return new SelfType( *this );
00747       }
00748 
00749    private:
00750       Holder holder_;
00751       MemberFn member_;
00752    };
00753 
00754    
00755    template< class Functor, class Return, class Arg1, class Arg2, class Arg3, class BindArg >
00756    class Bind3R
00757    {
00758    public:
00759    typedef Return result_type;
00760    typedef Arg1 arg1_type;
00761    typedef Arg1 first_argument_type;
00762    typedef Arg2 arg2_type;
00763    typedef Arg2 second_argument_type;
00764    typedef Arg3 arg3_type;
00765 
00766 
00767       Bind3R( Functor functor, BindArg arg )
00768          : functor_( functor )
00769          , arg_( arg )
00770       {
00771       }
00772 
00773       result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const
00774       {
00775          return functor_( a1, a2, a3, arg_ );
00776       }
00777    private:
00778       Functor functor_;
00779       BindArg arg_;
00780    };
00781 
00782 
00783    
00784    template< class Arg1, class Arg2, class Arg3, class Arg4 >
00785    class FunctorBase4 : public FunctorBase
00786    {
00787    public:
00788       virtual void operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) const = 0;
00789    };
00790 
00791    
00792    template< class Functor, class Arg1, class Arg2, class Arg3, class Arg4 >
00793    class GenericFunctor4 : public FunctorBase4< Arg1, Arg2, Arg3, Arg4 >
00794    {
00795    public:
00796       typedef GenericFunctor4< Functor, Arg1, Arg2, Arg3, Arg4 > SelfType;
00797 
00798       GenericFunctor4( const Functor &functor )
00799          : functor_( functor )
00800       {
00801       }
00802 
00803       void operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) const
00804       {
00805          functor_( a1, a2, a3, a4 );
00806       }
00807 
00808       FunctorBase *clone() const
00809       {
00810          return new SelfType( *this );
00811       }
00812 
00813    private:
00814       Functor functor_;
00815    };
00816 
00817    
00818    template< class Holder, class Object, class Arg1, class Arg2, class Arg3, class Arg4 >
00819    class MemberFunctor4 : public FunctorBase4< Arg1, Arg2, Arg3, Arg4 >
00820    {
00821    public:
00822       typedef MemberFunctor4< Holder, Object, Arg1, Arg2, Arg3, Arg4 > SelfType;
00823       typedef void (Object::*MemberFn)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 );
00824 
00825       MemberFunctor4( const Holder &holder, MemberFn member )
00826          : holder_( holder )
00827          , member_( member )
00828       {
00829       }
00830 
00831       void operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) const
00832       {
00833          Object &object = *holder_;
00834          (object.*member_)( a1, a2, a3, a4 );
00835       }
00836 
00837       FunctorBase *clone() const
00838       {
00839          return new SelfType( *this );
00840       }
00841 
00842    private:
00843       Holder holder_;
00844       MemberFn member_;
00845    };
00846 
00847    
00848    template< class Functor, class Arg1, class Arg2, class Arg3, class Arg4, class BindArg >
00849    class Bind4
00850    {
00851    public:
00852    typedef void result_type;
00853    typedef Arg1 arg1_type;
00854    typedef Arg1 first_argument_type;
00855    typedef Arg2 arg2_type;
00856    typedef Arg2 second_argument_type;
00857    typedef Arg3 arg3_type;
00858    typedef Arg4 arg4_type;
00859 
00860 
00861       Bind4( Functor functor, BindArg arg )
00862          : functor_( functor )
00863          , arg_( arg )
00864       {
00865       }
00866 
00867       result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) const
00868       {
00869          functor_( a1, a2, a3, a4, arg_ );
00870       }
00871    private:
00872       Functor functor_;
00873       BindArg arg_;
00874    };
00875 
00876 
00877    
00878    template< class Return, class Arg1, class Arg2, class Arg3, class Arg4 >
00879    class FunctorBase4R : public FunctorBase
00880    {
00881    public:
00882       virtual Return operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) const = 0;
00883    };
00884 
00885    
00886    template< class Functor, class Return, class Arg1, class Arg2, class Arg3, class Arg4 >
00887    class GenericFunctor4R : public FunctorBase4R< Return, Arg1, Arg2, Arg3, Arg4 >
00888    {
00889    public:
00890       typedef GenericFunctor4R< Functor, Return, Arg1, Arg2, Arg3, Arg4 > SelfType;
00891 
00892       GenericFunctor4R( const Functor &functor )
00893          : functor_( functor )
00894       {
00895       }
00896 
00897       Return operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) const
00898       {
00899          return functor_( a1, a2, a3, a4 );
00900       }
00901 
00902       FunctorBase *clone() const
00903       {
00904          return new SelfType( *this );
00905       }
00906 
00907    private:
00908       Functor functor_;
00909    };
00910 
00911    
00912    template< class Holder, class Object, class Return, class Arg1, class Arg2, class Arg3, class Arg4 >
00913    class MemberFunctor4R : public FunctorBase4R< Return, Arg1, Arg2, Arg3, Arg4 >
00914    {
00915    public:
00916       typedef MemberFunctor4R< Holder, Object, Return, Arg1, Arg2, Arg3, Arg4 > SelfType;
00917       typedef Return (Object::*MemberFn)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 );
00918 
00919       MemberFunctor4R( const Holder &holder, MemberFn member )
00920          : holder_( holder )
00921          , member_( member )
00922       {
00923       }
00924 
00925       Return operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) const
00926       {
00927          Object &object = *holder_;
00928          return (object.*member_)( a1, a2, a3, a4 );
00929       }
00930 
00931       FunctorBase *clone() const
00932       {
00933          return new SelfType( *this );
00934       }
00935 
00936    private:
00937       Holder holder_;
00938       MemberFn member_;
00939    };
00940 
00941    
00942    template< class Functor, class Return, class Arg1, class Arg2, class Arg3, class Arg4, class BindArg >
00943    class Bind4R
00944    {
00945    public:
00946    typedef Return result_type;
00947    typedef Arg1 arg1_type;
00948    typedef Arg1 first_argument_type;
00949    typedef Arg2 arg2_type;
00950    typedef Arg2 second_argument_type;
00951    typedef Arg3 arg3_type;
00952    typedef Arg4 arg4_type;
00953 
00954 
00955       Bind4R( Functor functor, BindArg arg )
00956          : functor_( functor )
00957          , arg_( arg )
00958       {
00959       }
00960 
00961       result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) const
00962       {
00963          return functor_( a1, a2, a3, a4, arg_ );
00964       }
00965    private:
00966       Functor functor_;
00967       BindArg arg_;
00968    };
00969 
00970 
00971    
00972    template< class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
00973    class FunctorBase5 : public FunctorBase
00974    {
00975    public:
00976       virtual void operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) const = 0;
00977    };
00978 
00979    
00980    template< class Functor, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
00981    class GenericFunctor5 : public FunctorBase5< Arg1, Arg2, Arg3, Arg4, Arg5 >
00982    {
00983    public:
00984       typedef GenericFunctor5< Functor, Arg1, Arg2, Arg3, Arg4, Arg5 > SelfType;
00985 
00986       GenericFunctor5( const Functor &functor )
00987          : functor_( functor )
00988       {
00989       }
00990 
00991       void operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) const
00992       {
00993          functor_( a1, a2, a3, a4, a5 );
00994       }
00995 
00996       FunctorBase *clone() const
00997       {
00998          return new SelfType( *this );
00999       }
01000 
01001    private:
01002       Functor functor_;
01003    };
01004 
01005    
01006    template< class Holder, class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
01007    class MemberFunctor5 : public FunctorBase5< Arg1, Arg2, Arg3, Arg4, Arg5 >
01008    {
01009    public:
01010       typedef MemberFunctor5< Holder, Object, Arg1, Arg2, Arg3, Arg4, Arg5 > SelfType;
01011       typedef void (Object::*MemberFn)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 );
01012 
01013       MemberFunctor5( const Holder &holder, MemberFn member )
01014          : holder_( holder )
01015          , member_( member )
01016       {
01017       }
01018 
01019       void operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) const
01020       {
01021          Object &object = *holder_;
01022          (object.*member_)( a1, a2, a3, a4, a5 );
01023       }
01024 
01025       FunctorBase *clone() const
01026       {
01027          return new SelfType( *this );
01028       }
01029 
01030    private:
01031       Holder holder_;
01032       MemberFn member_;
01033    };
01034 
01035    
01036    template< class Functor, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class BindArg >
01037    class Bind5
01038    {
01039    public:
01040    typedef void result_type;
01041    typedef Arg1 arg1_type;
01042    typedef Arg1 first_argument_type;
01043    typedef Arg2 arg2_type;
01044    typedef Arg2 second_argument_type;
01045    typedef Arg3 arg3_type;
01046    typedef Arg4 arg4_type;
01047    typedef Arg5 arg5_type;
01048 
01049 
01050       Bind5( Functor functor, BindArg arg )
01051          : functor_( functor )
01052          , arg_( arg )
01053       {
01054       }
01055 
01056       result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) const
01057       {
01058          functor_( a1, a2, a3, a4, a5, arg_ );
01059       }
01060    private:
01061       Functor functor_;
01062       BindArg arg_;
01063    };
01064 
01065 
01066    
01067    template< class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
01068    class FunctorBase5R : public FunctorBase
01069    {
01070    public:
01071       virtual Return operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) const = 0;
01072    };
01073 
01074    
01075    template< class Functor, class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
01076    class GenericFunctor5R : public FunctorBase5R< Return, Arg1, Arg2, Arg3, Arg4, Arg5 >
01077    {
01078    public:
01079       typedef GenericFunctor5R< Functor, Return, Arg1, Arg2, Arg3, Arg4, Arg5 > SelfType;
01080 
01081       GenericFunctor5R( const Functor &functor )
01082          : functor_( functor )
01083       {
01084       }
01085 
01086       Return operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) const
01087       {
01088          return functor_( a1, a2, a3, a4, a5 );
01089       }
01090 
01091       FunctorBase *clone() const
01092       {
01093          return new SelfType( *this );
01094       }
01095 
01096    private:
01097       Functor functor_;
01098    };
01099 
01100    
01101    template< class Holder, class Object, class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
01102    class MemberFunctor5R : public FunctorBase5R< Return, Arg1, Arg2, Arg3, Arg4, Arg5 >
01103    {
01104    public:
01105       typedef MemberFunctor5R< Holder, Object, Return, Arg1, Arg2, Arg3, Arg4, Arg5 > SelfType;
01106       typedef Return (Object::*MemberFn)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 );
01107 
01108       MemberFunctor5R( const Holder &holder, MemberFn member )
01109          : holder_( holder )
01110          , member_( member )
01111       {
01112       }
01113 
01114       Return operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) const
01115       {
01116          Object &object = *holder_;
01117          return (object.*member_)( a1, a2, a3, a4, a5 );
01118       }
01119 
01120       FunctorBase *clone() const
01121       {
01122          return new SelfType( *this );
01123       }
01124 
01125    private:
01126       Holder holder_;
01127       MemberFn member_;
01128    };
01129 
01130    
01131    template< class Functor, class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class BindArg >
01132    class Bind5R
01133    {
01134    public:
01135    typedef Return result_type;
01136    typedef Arg1 arg1_type;
01137    typedef Arg1 first_argument_type;
01138    typedef Arg2 arg2_type;
01139    typedef Arg2 second_argument_type;
01140    typedef Arg3 arg3_type;
01141    typedef Arg4 arg4_type;
01142    typedef Arg5 arg5_type;
01143 
01144 
01145       Bind5R( Functor functor, BindArg arg )
01146          : functor_( functor )
01147          , arg_( arg )
01148       {
01149       }
01150 
01151       result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) const
01152       {
01153          return functor_( a1, a2, a3, a4, a5, arg_ );
01154       }
01155    private:
01156       Functor functor_;
01157       BindArg arg_;
01158    };
01159 
01160 
01161    
01162 
01163 
01164 
01165 } // namespace Impl
01167 
01168 
01169 class FunctorCommon
01170 {
01171 public:
01172    ~FunctorCommon()
01173    {
01174       delete impl_;
01175    }
01176 
01177    bool empty() const
01178    {
01179       return impl_ == 0;
01180    }
01181 
01182    operator bool() const
01183    {
01184       return impl_ != 0;   
01185    }
01186 
01187    bool operator !() const
01188    {
01189       return impl_ == 0;
01190    }
01191 
01192 protected:
01193    FunctorCommon()
01194       : impl_( 0 )
01195    {
01196    }
01197 
01198    FunctorCommon( Impl::FunctorBase *impl )
01199       : impl_( impl )
01200    {
01201    }
01202 
01203    FunctorCommon( const FunctorCommon &other )
01204       : impl_( other.impl_ ? other.impl_->clone() : 0 )
01205    {
01206    }
01207 
01208    void swap( FunctorCommon &other )
01209    {
01210       Impl::FunctorBase *temp = impl_;
01211       impl_ = other.impl_;
01212       other.impl_ = temp;
01213    }
01214 
01215    Impl::FunctorBase *impl_;
01216 
01217 private:
01218    void operator =( const FunctorCommon &other );
01219 };
01220 
01221 
01222 class Functor0 : public FunctorCommon
01223 {
01224 public:
01225    typedef Functor0 SelfType;
01226    typedef Impl::FunctorBase0 FunctorImplType;
01227    typedef void result_type;
01228 
01229 
01230    Functor0()
01231    {
01232    }
01233 
01234    explicit Functor0( FunctorImplType *impl )
01235       : FunctorCommon( impl )
01236    {
01237    }
01238 
01239    Functor0( const SelfType &other )
01240       : FunctorCommon( other )
01241    {
01242    }
01243 
01244    SelfType &operator=( const SelfType &other )
01245    {
01246       SelfType temp( other );
01247       swap( temp );
01248       return *this;
01249    }
01250 
01251    result_type operator()(  ) const
01252    {
01253       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01254       impl(  );
01255    }
01256 
01257    void swap( SelfType &other )
01258    {
01259       FunctorCommon::swap( other );
01260    }
01261 };
01262 
01263 
01264 template< class Return >
01265 class Functor0R : public FunctorCommon
01266 {
01267 public:
01268    typedef Functor0R< Return > SelfType;
01269    typedef Impl::FunctorBase0R< Return > FunctorImplType;
01270    typedef Return result_type;
01271 
01272 
01273    Functor0R()
01274    {
01275    }
01276 
01277    explicit Functor0R( FunctorImplType *impl )
01278       : FunctorCommon( impl )
01279    {
01280    }
01281 
01282    Functor0R( const SelfType &other )
01283       : FunctorCommon( other )
01284    {
01285    }
01286 
01287    SelfType &operator=( const SelfType &other )
01288    {
01289       SelfType temp( other );
01290       swap( temp );
01291       return *this;
01292    }
01293 
01294    result_type operator()(  ) const
01295    {
01296       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01297       return impl(  );
01298    }
01299 
01300    void swap( SelfType &other )
01301    {
01302       FunctorCommon::swap( other );
01303    }
01304 };
01305 
01306 
01307 template< class Arg1 >
01308 class Functor1 : public FunctorCommon
01309 {
01310 public:
01311    typedef Functor1< Arg1 > SelfType;
01312    typedef Impl::FunctorBase1< Arg1 > FunctorImplType;
01313    typedef void result_type;
01314    typedef Arg1 arg1_type;
01315    typedef Arg1 first_argument_type;
01316 
01317 
01318    Functor1()
01319    {
01320    }
01321 
01322    explicit Functor1( FunctorImplType *impl )
01323       : FunctorCommon( impl )
01324    {
01325    }
01326 
01327    Functor1( const SelfType &other )
01328       : FunctorCommon( other )
01329    {
01330    }
01331 
01332    SelfType &operator=( const SelfType &other )
01333    {
01334       SelfType temp( other );
01335       swap( temp );
01336       return *this;
01337    }
01338 
01339    result_type operator()( Arg1 a1 ) const
01340    {
01341       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01342       impl( a1 );
01343    }
01344 
01345    void swap( SelfType &other )
01346    {
01347       FunctorCommon::swap( other );
01348    }
01349 };
01350 
01351 
01352 template< class Return, class Arg1 >
01353 class Functor1R : public FunctorCommon
01354 {
01355 public:
01356    typedef Functor1R< Return, Arg1 > SelfType;
01357    typedef Impl::FunctorBase1R< Return, Arg1 > FunctorImplType;
01358    typedef Return result_type;
01359    typedef Arg1 arg1_type;
01360    typedef Arg1 first_argument_type;
01361 
01362 
01363    Functor1R()
01364    {
01365    }
01366 
01367    explicit Functor1R( FunctorImplType *impl )
01368       : FunctorCommon( impl )
01369    {
01370    }
01371 
01372    Functor1R( const SelfType &other )
01373       : FunctorCommon( other )
01374    {
01375    }
01376 
01377    SelfType &operator=( const SelfType &other )
01378    {
01379       SelfType temp( other );
01380       swap( temp );
01381       return *this;
01382    }
01383 
01384    result_type operator()( Arg1 a1 ) const
01385    {
01386       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01387       return impl( a1 );
01388    }
01389 
01390    void swap( SelfType &other )
01391    {
01392       FunctorCommon::swap( other );
01393    }
01394 };
01395 
01396 
01397 template< class Arg1, class Arg2 >
01398 class Functor2 : public FunctorCommon
01399 {
01400 public:
01401    typedef Functor2< Arg1, Arg2 > SelfType;
01402    typedef Impl::FunctorBase2< Arg1, Arg2 > FunctorImplType;
01403    typedef void result_type;
01404    typedef Arg1 arg1_type;
01405    typedef Arg1 first_argument_type;
01406    typedef Arg2 arg2_type;
01407    typedef Arg2 second_argument_type;
01408 
01409 
01410    Functor2()
01411    {
01412    }
01413 
01414    explicit Functor2( FunctorImplType *impl )
01415       : FunctorCommon( impl )
01416    {
01417    }
01418 
01419    Functor2( const SelfType &other )
01420       : FunctorCommon( other )
01421    {
01422    }
01423 
01424    SelfType &operator=( const SelfType &other )
01425    {
01426       SelfType temp( other );
01427       swap( temp );
01428       return *this;
01429    }
01430 
01431    result_type operator()( Arg1 a1, Arg2 a2 ) const
01432    {
01433       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01434       impl( a1, a2 );
01435    }
01436 
01437    void swap( SelfType &other )
01438    {
01439       FunctorCommon::swap( other );
01440    }
01441 };
01442 
01443 
01444 template< class Return, class Arg1, class Arg2 >
01445 class Functor2R : public FunctorCommon
01446 {
01447 public:
01448    typedef Functor2R< Return, Arg1, Arg2 > SelfType;
01449    typedef Impl::FunctorBase2R< Return, Arg1, Arg2 > FunctorImplType;
01450    typedef Return result_type;
01451    typedef Arg1 arg1_type;
01452    typedef Arg1 first_argument_type;
01453    typedef Arg2 arg2_type;
01454    typedef Arg2 second_argument_type;
01455 
01456 
01457    Functor2R()
01458    {
01459    }
01460 
01461    explicit Functor2R( FunctorImplType *impl )
01462       : FunctorCommon( impl )
01463    {
01464    }
01465 
01466    Functor2R( const SelfType &other )
01467       : FunctorCommon( other )
01468    {
01469    }
01470 
01471    SelfType &operator=( const SelfType &other )
01472    {
01473       SelfType temp( other );
01474       swap( temp );
01475       return *this;
01476    }
01477 
01478    result_type operator()( Arg1 a1, Arg2 a2 ) const
01479    {
01480       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01481       return impl( a1, a2 );
01482    }
01483 
01484    void swap( SelfType &other )
01485    {
01486       FunctorCommon::swap( other );
01487    }
01488 };
01489 
01490 
01491 template< class Arg1, class Arg2, class Arg3 >
01492 class Functor3 : public FunctorCommon
01493 {
01494 public:
01495    typedef Functor3< Arg1, Arg2, Arg3 > SelfType;
01496    typedef Impl::FunctorBase3< Arg1, Arg2, Arg3 > FunctorImplType;
01497    typedef void result_type;
01498    typedef Arg1 arg1_type;
01499    typedef Arg1 first_argument_type;
01500    typedef Arg2 arg2_type;
01501    typedef Arg2 second_argument_type;
01502    typedef Arg3 arg3_type;
01503 
01504 
01505    Functor3()
01506    {
01507    }
01508 
01509    explicit Functor3( FunctorImplType *impl )
01510       : FunctorCommon( impl )
01511    {
01512    }
01513 
01514    Functor3( const SelfType &other )
01515       : FunctorCommon( other )
01516    {
01517    }
01518 
01519    SelfType &operator=( const SelfType &other )
01520    {
01521       SelfType temp( other );
01522       swap( temp );
01523       return *this;
01524    }
01525 
01526    result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const
01527    {
01528       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01529       impl( a1, a2, a3 );
01530    }
01531 
01532    void swap( SelfType &other )
01533    {
01534       FunctorCommon::swap( other );
01535    }
01536 };
01537 
01538 
01539 template< class Return, class Arg1, class Arg2, class Arg3 >
01540 class Functor3R : public FunctorCommon
01541 {
01542 public:
01543    typedef Functor3R< Return, Arg1, Arg2, Arg3 > SelfType;
01544    typedef Impl::FunctorBase3R< Return, Arg1, Arg2, Arg3 > FunctorImplType;
01545    typedef Return result_type;
01546    typedef Arg1 arg1_type;
01547    typedef Arg1 first_argument_type;
01548    typedef Arg2 arg2_type;
01549    typedef Arg2 second_argument_type;
01550    typedef Arg3 arg3_type;
01551 
01552 
01553    Functor3R()
01554    {
01555    }
01556 
01557    explicit Functor3R( FunctorImplType *impl )
01558       : FunctorCommon( impl )
01559    {
01560    }
01561 
01562    Functor3R( const SelfType &other )
01563       : FunctorCommon( other )
01564    {
01565    }
01566 
01567    SelfType &operator=( const SelfType &other )
01568    {
01569       SelfType temp( other );
01570       swap( temp );
01571       return *this;
01572    }
01573 
01574    result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3 ) const
01575    {
01576       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01577       return impl( a1, a2, a3 );
01578    }
01579 
01580    void swap( SelfType &other )
01581    {
01582       FunctorCommon::swap( other );
01583    }
01584 };
01585 
01586 
01587 template< class Arg1, class Arg2, class Arg3, class Arg4 >
01588 class Functor4 : public FunctorCommon
01589 {
01590 public:
01591    typedef Functor4< Arg1, Arg2, Arg3, Arg4 > SelfType;
01592    typedef Impl::FunctorBase4< Arg1, Arg2, Arg3, Arg4 > FunctorImplType;
01593    typedef void result_type;
01594    typedef Arg1 arg1_type;
01595    typedef Arg1 first_argument_type;
01596    typedef Arg2 arg2_type;
01597    typedef Arg2 second_argument_type;
01598    typedef Arg3 arg3_type;
01599    typedef Arg4 arg4_type;
01600 
01601 
01602    Functor4()
01603    {
01604    }
01605 
01606    explicit Functor4( FunctorImplType *impl )
01607       : FunctorCommon( impl )
01608    {
01609    }
01610 
01611    Functor4( const SelfType &other )
01612       : FunctorCommon( other )
01613    {
01614    }
01615 
01616    SelfType &operator=( const SelfType &other )
01617    {
01618       SelfType temp( other );
01619       swap( temp );
01620       return *this;
01621    }
01622 
01623    result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) const
01624    {
01625       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01626       impl( a1, a2, a3, a4 );
01627    }
01628 
01629    void swap( SelfType &other )
01630    {
01631       FunctorCommon::swap( other );
01632    }
01633 };
01634 
01635 
01636 template< class Return, class Arg1, class Arg2, class Arg3, class Arg4 >
01637 class Functor4R : public FunctorCommon
01638 {
01639 public:
01640    typedef Functor4R< Return, Arg1, Arg2, Arg3, Arg4 > SelfType;
01641    typedef Impl::FunctorBase4R< Return, Arg1, Arg2, Arg3, Arg4 > FunctorImplType;
01642    typedef Return result_type;
01643    typedef Arg1 arg1_type;
01644    typedef Arg1 first_argument_type;
01645    typedef Arg2 arg2_type;
01646    typedef Arg2 second_argument_type;
01647    typedef Arg3 arg3_type;
01648    typedef Arg4 arg4_type;
01649 
01650 
01651    Functor4R()
01652    {
01653    }
01654 
01655    explicit Functor4R( FunctorImplType *impl )
01656       : FunctorCommon( impl )
01657    {
01658    }
01659 
01660    Functor4R( const SelfType &other )
01661       : FunctorCommon( other )
01662    {
01663    }
01664 
01665    SelfType &operator=( const SelfType &other )
01666    {
01667       SelfType temp( other );
01668       swap( temp );
01669       return *this;
01670    }
01671 
01672    result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) const
01673    {
01674       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01675       return impl( a1, a2, a3, a4 );
01676    }
01677 
01678    void swap( SelfType &other )
01679    {
01680       FunctorCommon::swap( other );
01681    }
01682 };
01683 
01684 
01685 template< class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
01686 class Functor5 : public FunctorCommon
01687 {
01688 public:
01689    typedef Functor5< Arg1, Arg2, Arg3, Arg4, Arg5 > SelfType;
01690    typedef Impl::FunctorBase5< Arg1, Arg2, Arg3, Arg4, Arg5 > FunctorImplType;
01691    typedef void result_type;
01692    typedef Arg1 arg1_type;
01693    typedef Arg1 first_argument_type;
01694    typedef Arg2 arg2_type;
01695    typedef Arg2 second_argument_type;
01696    typedef Arg3 arg3_type;
01697    typedef Arg4 arg4_type;
01698    typedef Arg5 arg5_type;
01699 
01700 
01701    Functor5()
01702    {
01703    }
01704 
01705    explicit Functor5( FunctorImplType *impl )
01706       : FunctorCommon( impl )
01707    {
01708    }
01709 
01710    Functor5( const SelfType &other )
01711       : FunctorCommon( other )
01712    {
01713    }
01714 
01715    SelfType &operator=( const SelfType &other )
01716    {
01717       SelfType temp( other );
01718       swap( temp );
01719       return *this;
01720    }
01721 
01722    result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) const
01723    {
01724       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01725       impl( a1, a2, a3, a4, a5 );
01726    }
01727 
01728    void swap( SelfType &other )
01729    {
01730       FunctorCommon::swap( other );
01731    }
01732 };
01733 
01734 
01735 template< class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
01736 class Functor5R : public FunctorCommon
01737 {
01738 public:
01739    typedef Functor5R< Return, Arg1, Arg2, Arg3, Arg4, Arg5 > SelfType;
01740    typedef Impl::FunctorBase5R< Return, Arg1, Arg2, Arg3, Arg4, Arg5 > FunctorImplType;
01741    typedef Return result_type;
01742    typedef Arg1 arg1_type;
01743    typedef Arg1 first_argument_type;
01744    typedef Arg2 arg2_type;
01745    typedef Arg2 second_argument_type;
01746    typedef Arg3 arg3_type;
01747    typedef Arg4 arg4_type;
01748    typedef Arg5 arg5_type;
01749 
01750 
01751    Functor5R()
01752    {
01753    }
01754 
01755    explicit Functor5R( FunctorImplType *impl )
01756       : FunctorCommon( impl )
01757    {
01758    }
01759 
01760    Functor5R( const SelfType &other )
01761       : FunctorCommon( other )
01762    {
01763    }
01764 
01765    SelfType &operator=( const SelfType &other )
01766    {
01767       SelfType temp( other );
01768       swap( temp );
01769       return *this;
01770    }
01771 
01772    result_type operator()( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) const
01773    {
01774       FunctorImplType &impl = *( static_cast<FunctorImplType *>(impl_) );
01775       return impl( a1, a2, a3, a4, a5 );
01776    }
01777 
01778    void swap( SelfType &other )
01779    {
01780       FunctorCommon::swap( other );
01781    }
01782 };
01783 
01784 
01785 
01786 
01787 // Functor0
01788 
01789 
01790 inline Functor0 cfn0( void (*function)(  ) )
01791 {
01792    typedef void (*Functor)();
01793    return Functor0( new Impl::GenericFunctor0< Functor >( function ) );
01794 }
01795 
01796 template< class Holder, class Object >
01797 inline Functor0
01798 memfn0( const Holder &holder, void (Object::*member)(  ) )
01799 {
01800    return Functor0( new Impl::MemberFunctor0< Holder, Object >( holder, member ) );
01801 }
01802 
01803 template<class Functor>
01804 inline Functor0
01805 fn0( Functor functor )
01806 {
01807 
01808    return Functor0( new Impl::GenericFunctor0< Functor >( functor ) );
01809 }
01810 
01811 template<class Functor, class BindArg>
01812 inline Impl::Bind0<Functor
01813            ,BindArg >
01814 bind1( Functor functor, BindArg arg )
01815 {
01816    return Impl::Bind0<Functor
01817            ,BindArg >( functor, arg );
01818 }
01819 
01820 // Functor0R
01821 
01822 template< class Return >
01823 inline Functor0R< Return > cfn0r( Return (*function)(  ) )
01824 {
01825    typedef Return (*Functor)();
01826    return Functor0R< Return >( new Impl::GenericFunctor0R< Functor, Return >( function ) );
01827 }
01828 
01829 template< class Holder, class Object, class Return >
01830 inline Functor0R< Return >
01831 memfn0r( const Holder &holder, Return (Object::*member)(  ) )
01832 {
01833    return Functor0R< Return >( new Impl::MemberFunctor0R< Holder, Object, Return >( holder, member ) );
01834 }
01835 
01836 template<class Functor>
01837 inline Functor0R< CPPTL_TYPENAME Functor::result_type >
01838 fn0r( Functor functor )
01839 {
01840    typedef CPPTL_TYPENAME Functor::result_type Return;
01841    return Functor0R< Return >( new Impl::GenericFunctor0R< Functor, Return >( functor ) );
01842 }
01843 
01844 template<class Functor, class BindArg>
01845 inline Impl::Bind0R<Functor
01846            ,CPPTL_TYPENAME Functor::result_type
01847            ,BindArg >
01848 bind1r( Functor functor, BindArg arg )
01849 {
01850    return Impl::Bind0R<Functor
01851            ,CPPTL_TYPENAME Functor::result_type
01852            ,BindArg >( functor, arg );
01853 }
01854 
01855 // Functor1
01856 
01857 template< class Arg1 >
01858 inline Functor1< Arg1 > cfn1( void (*function)( Arg1 a1 ) )
01859 {
01860    typedef void (*Functor)(Arg1);
01861    return Functor1< Arg1 >( new Impl::GenericFunctor1< Functor, Arg1 >( function ) );
01862 }
01863 
01864 template< class Holder, class Object, class Arg1 >
01865 inline Functor1< Arg1 >
01866 memfn1( const Holder &holder, void (Object::*member)( Arg1 a1 ) )
01867 {
01868    return Functor1< Arg1 >( new Impl::MemberFunctor1< Holder, Object, Arg1 >( holder, member ) );
01869 }
01870 
01871 template<class Functor>
01872 inline Functor1< CPPTL_TYPENAME Functor::first_argument_type >
01873 fn1( Functor functor )
01874 {
01875    typedef CPPTL_TYPENAME Functor::first_argument_type Arg1;
01876    return Functor1< Arg1 >( new Impl::GenericFunctor1< Functor, Arg1 >( functor ) );
01877 }
01878 
01879 template<class Functor, class BindArg>
01880 inline Impl::Bind1<Functor
01881            ,CPPTL_TYPENAME Functor::first_argument_type
01882            ,BindArg >
01883 bind2( Functor functor, BindArg arg )
01884 {
01885    return Impl::Bind1<Functor
01886            ,CPPTL_TYPENAME Functor::first_argument_type
01887            ,BindArg >( functor, arg );
01888 }
01889 
01890 template< class Functor, class Arg1 >
01891 inline Functor0
01892 bind( Functor functor, Arg1 a1 )
01893 {
01894     return fn0( bind1( functor, a1 ) );
01895 }
01896 
01897 template< class Arg1, class FA1 >
01898 inline Functor0
01899 bind_cfn( void (*function)( FA1 ), Arg1 a1 )
01900 {
01901     return fn0( bind1( cfn1( function ), a1 ) );
01902 }
01903 
01904 template< class Holder, class Object, class Arg1, class FA1 >
01905 inline  Functor0
01906 bind_memfn( const Holder &holder,
01907              void (Object::*member)( FA1 ),
01908              Arg1 a1 )
01909 {
01910     return fn0( bind1( memfn1( holder, member ), a1 ) );
01911 }
01912 
01913 // Functor1R
01914 
01915 template< class Return, class Arg1 >
01916 inline Functor1R< Return, Arg1 > cfn1r( Return (*function)( Arg1 a1 ) )
01917 {
01918    typedef Return (*Functor)(Arg1);
01919    return Functor1R< Return, Arg1 >( new Impl::GenericFunctor1R< Functor, Return, Arg1 >( function ) );
01920 }
01921 
01922 template< class Holder, class Object, class Return, class Arg1 >
01923 inline Functor1R< Return, Arg1 >
01924 memfn1r( const Holder &holder, Return (Object::*member)( Arg1 a1 ) )
01925 {
01926    return Functor1R< Return, Arg1 >( new Impl::MemberFunctor1R< Holder, Object, Return, Arg1 >( holder, member ) );
01927 }
01928 
01929 template<class Functor>
01930 inline Functor1R< CPPTL_TYPENAME Functor::result_type
01931            ,CPPTL_TYPENAME Functor::first_argument_type >
01932 fn1r( Functor functor )
01933 {
01934    typedef CPPTL_TYPENAME Functor::result_type Return;
01935    typedef CPPTL_TYPENAME Functor::first_argument_type Arg1;
01936    return Functor1R< Return, Arg1 >( new Impl::GenericFunctor1R< Functor, Return, Arg1 >( functor ) );
01937 }
01938 
01939 template<class Functor, class BindArg>
01940 inline Impl::Bind1R<Functor
01941            ,CPPTL_TYPENAME Functor::result_type
01942            ,CPPTL_TYPENAME Functor::first_argument_type
01943            ,BindArg >
01944 bind2r( Functor functor, BindArg arg )
01945 {
01946    return Impl::Bind1R<Functor
01947            ,CPPTL_TYPENAME Functor::result_type
01948            ,CPPTL_TYPENAME Functor::first_argument_type
01949            ,BindArg >( functor, arg );
01950 }
01951 
01952 template< class Functor, class Arg1 >
01953 inline Functor0R<CPPTL_TYPENAME Functor::result_type>
01954 bindr( Functor functor, Arg1 a1 )
01955 {
01956     return fn0r( bind1r( functor, a1 ) );
01957 }
01958 
01959 template< class Return, class Arg1, class FA1 >
01960 inline Functor0R<Return>
01961 bind_cfnr( Return (*function)( FA1 ), Arg1 a1 )
01962 {
01963     return fn0r( bind1r( cfn1r( function ), a1 ) );
01964 }
01965 
01966 template< class Holder, class Object, class Return, class Arg1, class FA1 >
01967 inline  Functor0R<Return>
01968 bind_memfnr( const Holder &holder,
01969              Return (Object::*member)( FA1 ),
01970              Arg1 a1 )
01971 {
01972     return fn0r( bind1r( memfn1r( holder, member ), a1 ) );
01973 }
01974 
01975 // Functor2
01976 
01977 template< class Arg1, class Arg2 >
01978 inline Functor2< Arg1, Arg2 > cfn2( void (*function)( Arg1 a1, Arg2 a2 ) )
01979 {
01980    typedef void (*Functor)(Arg1,Arg2);
01981    return Functor2< Arg1, Arg2 >( new Impl::GenericFunctor2< Functor, Arg1, Arg2 >( function ) );
01982 }
01983 
01984 template< class Holder, class Object, class Arg1, class Arg2 >
01985 inline Functor2< Arg1, Arg2 >
01986 memfn2( const Holder &holder, void (Object::*member)( Arg1 a1, Arg2 a2 ) )
01987 {
01988    return Functor2< Arg1, Arg2 >( new Impl::MemberFunctor2< Holder, Object, Arg1, Arg2 >( holder, member ) );
01989 }
01990 
01991 template<class Functor>
01992 inline Functor2< CPPTL_TYPENAME Functor::first_argument_type
01993            ,CPPTL_TYPENAME Functor::second_argument_type >
01994 fn2( Functor functor )
01995 {
01996    typedef CPPTL_TYPENAME Functor::first_argument_type Arg1;
01997    typedef CPPTL_TYPENAME Functor::second_argument_type Arg2;
01998    return Functor2< Arg1, Arg2 >( new Impl::GenericFunctor2< Functor, Arg1, Arg2 >( functor ) );
01999 }
02000 
02001 template<class Functor, class BindArg>
02002 inline Impl::Bind2<Functor
02003            ,CPPTL_TYPENAME Functor::first_argument_type
02004            ,CPPTL_TYPENAME Functor::second_argument_type
02005            ,BindArg >
02006 bind3( Functor functor, BindArg arg )
02007 {
02008    return Impl::Bind2<Functor
02009            ,CPPTL_TYPENAME Functor::first_argument_type
02010            ,CPPTL_TYPENAME Functor::second_argument_type
02011            ,BindArg >( functor, arg );
02012 }
02013 
02014 template< class Functor, class Arg1, class Arg2 >
02015 inline Functor0
02016 bind( Functor functor, Arg1 a1, Arg2 a2 )
02017 {
02018     return fn0( bind1( bind2( functor, a2 ), a1 ) );
02019 }
02020 
02021 template< class Arg1, class Arg2, class FA1, class FA2 >
02022 inline Functor0
02023 bind_cfn( void (*function)( FA1, FA2 ), Arg1 a1, Arg2 a2 )
02024 {
02025     return fn0( bind1( bind2( cfn2( function ), a2 ), a1 ) );
02026 }
02027 
02028 template< class Holder, class Object, class Arg1, class Arg2, class FA1, class FA2 >
02029 inline  Functor0
02030 bind_memfn( const Holder &holder,
02031              void (Object::*member)( FA1, FA2 ),
02032              Arg1 a1, Arg2 a2 )
02033 {
02034     return fn0( bind1( bind2( memfn2( holder, member ), a2 ), a1 ) );
02035 }
02036 
02037 // Functor2R
02038 
02039 template< class Return, class Arg1, class Arg2 >
02040 inline Functor2R< Return, Arg1, Arg2 > cfn2r( Return (*function)( Arg1 a1, Arg2 a2 ) )
02041 {
02042    typedef Return (*Functor)(Arg1,Arg2);
02043    return Functor2R< Return, Arg1, Arg2 >( new Impl::GenericFunctor2R< Functor, Return, Arg1, Arg2 >( function ) );
02044 }
02045 
02046 template< class Holder, class Object, class Return, class Arg1, class Arg2 >
02047 inline Functor2R< Return, Arg1, Arg2 >
02048 memfn2r( const Holder &holder, Return (Object::*member)( Arg1 a1, Arg2 a2 ) )
02049 {
02050    return Functor2R< Return, Arg1, Arg2 >( new Impl::MemberFunctor2R< Holder, Object, Return, Arg1, Arg2 >( holder, member ) );
02051 }
02052 
02053 template<class Functor>
02054 inline Functor2R< CPPTL_TYPENAME Functor::result_type
02055            ,CPPTL_TYPENAME Functor::first_argument_type
02056            ,CPPTL_TYPENAME Functor::second_argument_type >
02057 fn2r( Functor functor )
02058 {
02059    typedef CPPTL_TYPENAME Functor::result_type Return;
02060    typedef CPPTL_TYPENAME Functor::first_argument_type Arg1;
02061    typedef CPPTL_TYPENAME Functor::second_argument_type Arg2;
02062    return Functor2R< Return, Arg1, Arg2 >( new Impl::GenericFunctor2R< Functor, Return, Arg1, Arg2 >( functor ) );
02063 }
02064 
02065 template<class Functor, class BindArg>
02066 inline Impl::Bind2R<Functor
02067            ,CPPTL_TYPENAME Functor::result_type
02068            ,CPPTL_TYPENAME Functor::first_argument_type
02069            ,CPPTL_TYPENAME Functor::second_argument_type
02070            ,BindArg >
02071 bind3r( Functor functor, BindArg arg )
02072 {
02073    return Impl::Bind2R<Functor
02074            ,CPPTL_TYPENAME Functor::result_type
02075            ,CPPTL_TYPENAME Functor::first_argument_type
02076            ,CPPTL_TYPENAME Functor::second_argument_type
02077            ,BindArg >( functor, arg );
02078 }
02079 
02080 template< class Functor, class Arg1, class Arg2 >
02081 inline Functor0R<CPPTL_TYPENAME Functor::result_type>
02082 bindr( Functor functor, Arg1 a1, Arg2 a2 )
02083 {
02084     return fn0r( bind1r( bind2r( functor, a2 ), a1 ) );
02085 }
02086 
02087 template< class Return, class Arg1, class Arg2, class FA1, class FA2 >
02088 inline Functor0R<Return>
02089 bind_cfnr( Return (*function)( FA1, FA2 ), Arg1 a1, Arg2 a2 )
02090 {
02091     return fn0r( bind1r( bind2r( cfn2r( function ), a2 ), a1 ) );
02092 }
02093 
02094 template< class Holder, class Object, class Return, class Arg1, class Arg2, class FA1, class FA2 >
02095 inline  Functor0R<Return>
02096 bind_memfnr( const Holder &holder,
02097              Return (Object::*member)( FA1, FA2 ),
02098              Arg1 a1, Arg2 a2 )
02099 {
02100     return fn0r( bind1r( bind2r( memfn2r( holder, member ), a2 ), a1 ) );
02101 }
02102 
02103 // Functor3
02104 
02105 template< class Arg1, class Arg2, class Arg3 >
02106 inline Functor3< Arg1, Arg2, Arg3 > cfn3( void (*function)( Arg1 a1, Arg2 a2, Arg3 a3 ) )
02107 {
02108    typedef void (*Functor)(Arg1,Arg2,Arg3);
02109    return Functor3< Arg1, Arg2, Arg3 >( new Impl::GenericFunctor3< Functor, Arg1, Arg2, Arg3 >( function ) );
02110 }
02111 
02112 template< class Holder, class Object, class Arg1, class Arg2, class Arg3 >
02113 inline Functor3< Arg1, Arg2, Arg3 >
02114 memfn3( const Holder &holder, void (Object::*member)( Arg1 a1, Arg2 a2, Arg3 a3 ) )
02115 {
02116    return Functor3< Arg1, Arg2, Arg3 >( new Impl::MemberFunctor3< Holder, Object, Arg1, Arg2, Arg3 >( holder, member ) );
02117 }
02118 
02119 template<class Functor>
02120 inline Functor3< CPPTL_TYPENAME Functor::first_argument_type
02121            ,CPPTL_TYPENAME Functor::second_argument_type
02122            ,CPPTL_TYPENAME Functor::arg3_type >
02123 fn3( Functor functor )
02124 {
02125    typedef CPPTL_TYPENAME Functor::first_argument_type Arg1;
02126    typedef CPPTL_TYPENAME Functor::second_argument_type Arg2;
02127    typedef CPPTL_TYPENAME Functor::arg3_type Arg3;
02128    return Functor3< Arg1, Arg2, Arg3 >( new Impl::GenericFunctor3< Functor, Arg1, Arg2, Arg3 >( functor ) );
02129 }
02130 
02131 template<class Functor, class BindArg>
02132 inline Impl::Bind3<Functor
02133            ,CPPTL_TYPENAME Functor::first_argument_type
02134            ,CPPTL_TYPENAME Functor::second_argument_type
02135            ,CPPTL_TYPENAME Functor::arg3_type
02136            ,BindArg >
02137 bind4( Functor functor, BindArg arg )
02138 {
02139    return Impl::Bind3<Functor
02140            ,CPPTL_TYPENAME Functor::first_argument_type
02141            ,CPPTL_TYPENAME Functor::second_argument_type
02142            ,CPPTL_TYPENAME Functor::arg3_type
02143            ,BindArg >( functor, arg );
02144 }
02145 
02146 template< class Functor, class Arg1, class Arg2, class Arg3 >
02147 inline Functor0
02148 bind( Functor functor, Arg1 a1, Arg2 a2, Arg3 a3 )
02149 {
02150     return fn0( bind1( bind2( bind3( functor, a3 ), a2 ), a1 ) );
02151 }
02152 
02153 template< class Arg1, class Arg2, class Arg3, class FA1, class FA2, class FA3 >
02154 inline Functor0
02155 bind_cfn( void (*function)( FA1, FA2, FA3 ), Arg1 a1, Arg2 a2, Arg3 a3 )
02156 {
02157     return fn0( bind1( bind2( bind3( cfn3( function ), a3 ), a2 ), a1 ) );
02158 }
02159 
02160 template< class Holder, class Object, class Arg1, class Arg2, class Arg3, class FA1, class FA2, class FA3 >
02161 inline  Functor0
02162 bind_memfn( const Holder &holder,
02163              void (Object::*member)( FA1, FA2, FA3 ),
02164              Arg1 a1, Arg2 a2, Arg3 a3 )
02165 {
02166     return fn0( bind1( bind2( bind3( memfn3( holder, member ), a3 ), a2 ), a1 ) );
02167 }
02168 
02169 // Functor3R
02170 
02171 template< class Return, class Arg1, class Arg2, class Arg3 >
02172 inline Functor3R< Return, Arg1, Arg2, Arg3 > cfn3r( Return (*function)( Arg1 a1, Arg2 a2, Arg3 a3 ) )
02173 {
02174    typedef Return (*Functor)(Arg1,Arg2,Arg3);
02175    return Functor3R< Return, Arg1, Arg2, Arg3 >( new Impl::GenericFunctor3R< Functor, Return, Arg1, Arg2, Arg3 >( function ) );
02176 }
02177 
02178 template< class Holder, class Object, class Return, class Arg1, class Arg2, class Arg3 >
02179 inline Functor3R< Return, Arg1, Arg2, Arg3 >
02180 memfn3r( const Holder &holder, Return (Object::*member)( Arg1 a1, Arg2 a2, Arg3 a3 ) )
02181 {
02182    return Functor3R< Return, Arg1, Arg2, Arg3 >( new Impl::MemberFunctor3R< Holder, Object, Return, Arg1, Arg2, Arg3 >( holder, member ) );
02183 }
02184 
02185 template<class Functor>
02186 inline Functor3R< CPPTL_TYPENAME Functor::result_type
02187            ,CPPTL_TYPENAME Functor::first_argument_type
02188            ,CPPTL_TYPENAME Functor::second_argument_type
02189            ,CPPTL_TYPENAME Functor::arg3_type >
02190 fn3r( Functor functor )
02191 {
02192    typedef CPPTL_TYPENAME Functor::result_type Return;
02193    typedef CPPTL_TYPENAME Functor::first_argument_type Arg1;
02194    typedef CPPTL_TYPENAME Functor::second_argument_type Arg2;
02195    typedef CPPTL_TYPENAME Functor::arg3_type Arg3;
02196    return Functor3R< Return, Arg1, Arg2, Arg3 >( new Impl::GenericFunctor3R< Functor, Return, Arg1, Arg2, Arg3 >( functor ) );
02197 }
02198 
02199 template<class Functor, class BindArg>
02200 inline Impl::Bind3R<Functor
02201            ,CPPTL_TYPENAME Functor::result_type
02202            ,CPPTL_TYPENAME Functor::first_argument_type
02203            ,CPPTL_TYPENAME Functor::second_argument_type
02204            ,CPPTL_TYPENAME Functor::arg3_type
02205            ,BindArg >
02206 bind4r( Functor functor, BindArg arg )
02207 {
02208    return Impl::Bind3R<Functor
02209            ,CPPTL_TYPENAME Functor::result_type
02210            ,CPPTL_TYPENAME Functor::first_argument_type
02211            ,CPPTL_TYPENAME Functor::second_argument_type
02212            ,CPPTL_TYPENAME Functor::arg3_type
02213            ,BindArg >( functor, arg );
02214 }
02215 
02216 template< class Functor, class Arg1, class Arg2, class Arg3 >
02217 inline Functor0R<CPPTL_TYPENAME Functor::result_type>
02218 bindr( Functor functor, Arg1 a1, Arg2 a2, Arg3 a3 )
02219 {
02220     return fn0r( bind1r( bind2r( bind3r( functor, a3 ), a2 ), a1 ) );
02221 }
02222 
02223 template< class Return, class Arg1, class Arg2, class Arg3, class FA1, class FA2, class FA3 >
02224 inline Functor0R<Return>
02225 bind_cfnr( Return (*function)( FA1, FA2, FA3 ), Arg1 a1, Arg2 a2, Arg3 a3 )
02226 {
02227     return fn0r( bind1r( bind2r( bind3r( cfn3r( function ), a3 ), a2 ), a1 ) );
02228 }
02229 
02230 template< class Holder, class Object, class Return, class Arg1, class Arg2, class Arg3, class FA1, class FA2, class FA3 >
02231 inline  Functor0R<Return>
02232 bind_memfnr( const Holder &holder,
02233              Return (Object::*member)( FA1, FA2, FA3 ),
02234              Arg1 a1, Arg2 a2, Arg3 a3 )
02235 {
02236     return fn0r( bind1r( bind2r( bind3r( memfn3r( holder, member ), a3 ), a2 ), a1 ) );
02237 }
02238 
02239 // Functor4
02240 
02241 template< class Arg1, class Arg2, class Arg3, class Arg4 >
02242 inline Functor4< Arg1, Arg2, Arg3, Arg4 > cfn4( void (*function)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) )
02243 {
02244    typedef void (*Functor)(Arg1,Arg2,Arg3,Arg4);
02245    return Functor4< Arg1, Arg2, Arg3, Arg4 >( new Impl::GenericFunctor4< Functor, Arg1, Arg2, Arg3, Arg4 >( function ) );
02246 }
02247 
02248 template< class Holder, class Object, class Arg1, class Arg2, class Arg3, class Arg4 >
02249 inline Functor4< Arg1, Arg2, Arg3, Arg4 >
02250 memfn4( const Holder &holder, void (Object::*member)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) )
02251 {
02252    return Functor4< Arg1, Arg2, Arg3, Arg4 >( new Impl::MemberFunctor4< Holder, Object, Arg1, Arg2, Arg3, Arg4 >( holder, member ) );
02253 }
02254 
02255 template<class Functor>
02256 inline Functor4< CPPTL_TYPENAME Functor::first_argument_type
02257            ,CPPTL_TYPENAME Functor::second_argument_type
02258            ,CPPTL_TYPENAME Functor::arg3_type
02259            ,CPPTL_TYPENAME Functor::arg4_type >
02260 fn4( Functor functor )
02261 {
02262    typedef CPPTL_TYPENAME Functor::first_argument_type Arg1;
02263    typedef CPPTL_TYPENAME Functor::second_argument_type Arg2;
02264    typedef CPPTL_TYPENAME Functor::arg3_type Arg3;
02265    typedef CPPTL_TYPENAME Functor::arg4_type Arg4;
02266    return Functor4< Arg1, Arg2, Arg3, Arg4 >( new Impl::GenericFunctor4< Functor, Arg1, Arg2, Arg3, Arg4 >( functor ) );
02267 }
02268 
02269 template<class Functor, class BindArg>
02270 inline Impl::Bind4<Functor
02271            ,CPPTL_TYPENAME Functor::first_argument_type
02272            ,CPPTL_TYPENAME Functor::second_argument_type
02273            ,CPPTL_TYPENAME Functor::arg3_type
02274            ,CPPTL_TYPENAME Functor::arg4_type
02275            ,BindArg >
02276 bind5( Functor functor, BindArg arg )
02277 {
02278    return Impl::Bind4<Functor
02279            ,CPPTL_TYPENAME Functor::first_argument_type
02280            ,CPPTL_TYPENAME Functor::second_argument_type
02281            ,CPPTL_TYPENAME Functor::arg3_type
02282            ,CPPTL_TYPENAME Functor::arg4_type
02283            ,BindArg >( functor, arg );
02284 }
02285 
02286 template< class Functor, class Arg1, class Arg2, class Arg3, class Arg4 >
02287 inline Functor0
02288 bind( Functor functor, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 )
02289 {
02290     return fn0( bind1( bind2( bind3( bind4( functor, a4 ), a3 ), a2 ), a1 ) );
02291 }
02292 
02293 template< class Arg1, class Arg2, class Arg3, class Arg4, class FA1, class FA2, class FA3, class FA4 >
02294 inline Functor0
02295 bind_cfn( void (*function)( FA1, FA2, FA3, FA4 ), Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 )
02296 {
02297     return fn0( bind1( bind2( bind3( bind4( cfn4( function ), a4 ), a3 ), a2 ), a1 ) );
02298 }
02299 
02300 template< class Holder, class Object, class Arg1, class Arg2, class Arg3, class Arg4, class FA1, class FA2, class FA3, class FA4 >
02301 inline  Functor0
02302 bind_memfn( const Holder &holder,
02303              void (Object::*member)( FA1, FA2, FA3, FA4 ),
02304              Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 )
02305 {
02306     return fn0( bind1( bind2( bind3( bind4( memfn4( holder, member ), a4 ), a3 ), a2 ), a1 ) );
02307 }
02308 
02309 // Functor4R
02310 
02311 template< class Return, class Arg1, class Arg2, class Arg3, class Arg4 >
02312 inline Functor4R< Return, Arg1, Arg2, Arg3, Arg4 > cfn4r( Return (*function)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) )
02313 {
02314    typedef Return (*Functor)(Arg1,Arg2,Arg3,Arg4);
02315    return Functor4R< Return, Arg1, Arg2, Arg3, Arg4 >( new Impl::GenericFunctor4R< Functor, Return, Arg1, Arg2, Arg3, Arg4 >( function ) );
02316 }
02317 
02318 template< class Holder, class Object, class Return, class Arg1, class Arg2, class Arg3, class Arg4 >
02319 inline Functor4R< Return, Arg1, Arg2, Arg3, Arg4 >
02320 memfn4r( const Holder &holder, Return (Object::*member)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 ) )
02321 {
02322    return Functor4R< Return, Arg1, Arg2, Arg3, Arg4 >( new Impl::MemberFunctor4R< Holder, Object, Return, Arg1, Arg2, Arg3, Arg4 >( holder, member ) );
02323 }
02324 
02325 template<class Functor>
02326 inline Functor4R< CPPTL_TYPENAME Functor::result_type
02327            ,CPPTL_TYPENAME Functor::first_argument_type
02328            ,CPPTL_TYPENAME Functor::second_argument_type
02329            ,CPPTL_TYPENAME Functor::arg3_type
02330            ,CPPTL_TYPENAME Functor::arg4_type >
02331 fn4r( Functor functor )
02332 {
02333    typedef CPPTL_TYPENAME Functor::result_type Return;
02334    typedef CPPTL_TYPENAME Functor::first_argument_type Arg1;
02335    typedef CPPTL_TYPENAME Functor::second_argument_type Arg2;
02336    typedef CPPTL_TYPENAME Functor::arg3_type Arg3;
02337    typedef CPPTL_TYPENAME Functor::arg4_type Arg4;
02338    return Functor4R< Return, Arg1, Arg2, Arg3, Arg4 >( new Impl::GenericFunctor4R< Functor, Return, Arg1, Arg2, Arg3, Arg4 >( functor ) );
02339 }
02340 
02341 template<class Functor, class BindArg>
02342 inline Impl::Bind4R<Functor
02343            ,CPPTL_TYPENAME Functor::result_type
02344            ,CPPTL_TYPENAME Functor::first_argument_type
02345            ,CPPTL_TYPENAME Functor::second_argument_type
02346            ,CPPTL_TYPENAME Functor::arg3_type
02347            ,CPPTL_TYPENAME Functor::arg4_type
02348            ,BindArg >
02349 bind5r( Functor functor, BindArg arg )
02350 {
02351    return Impl::Bind4R<Functor
02352            ,CPPTL_TYPENAME Functor::result_type
02353            ,CPPTL_TYPENAME Functor::first_argument_type
02354            ,CPPTL_TYPENAME Functor::second_argument_type
02355            ,CPPTL_TYPENAME Functor::arg3_type
02356            ,CPPTL_TYPENAME Functor::arg4_type
02357            ,BindArg >( functor, arg );
02358 }
02359 
02360 template< class Functor, class Arg1, class Arg2, class Arg3, class Arg4 >
02361 inline Functor0R<CPPTL_TYPENAME Functor::result_type>
02362 bindr( Functor functor, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 )
02363 {
02364     return fn0r( bind1r( bind2r( bind3r( bind4r( functor, a4 ), a3 ), a2 ), a1 ) );
02365 }
02366 
02367 template< class Return, class Arg1, class Arg2, class Arg3, class Arg4, class FA1, class FA2, class FA3, class FA4 >
02368 inline Functor0R<Return>
02369 bind_cfnr( Return (*function)( FA1, FA2, FA3, FA4 ), Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 )
02370 {
02371     return fn0r( bind1r( bind2r( bind3r( bind4r( cfn4r( function ), a4 ), a3 ), a2 ), a1 ) );
02372 }
02373 
02374 template< class Holder, class Object, class Return, class Arg1, class Arg2, class Arg3, class Arg4, class FA1, class FA2, class FA3, class FA4 >
02375 inline  Functor0R<Return>
02376 bind_memfnr( const Holder &holder,
02377              Return (Object::*member)( FA1, FA2, FA3, FA4 ),
02378              Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4 )
02379 {
02380     return fn0r( bind1r( bind2r( bind3r( bind4r( memfn4r( holder, member ), a4 ), a3 ), a2 ), a1 ) );
02381 }
02382 
02383 // Functor5
02384 
02385 template< class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
02386 inline Functor5< Arg1, Arg2, Arg3, Arg4, Arg5 > cfn5( void (*function)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) )
02387 {
02388    typedef void (*Functor)(Arg1,Arg2,Arg3,Arg4,Arg5);
02389    return Functor5< Arg1, Arg2, Arg3, Arg4, Arg5 >( new Impl::GenericFunctor5< Functor, Arg1, Arg2, Arg3, Arg4, Arg5 >( function ) );
02390 }
02391 
02392 template< class Holder, class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
02393 inline Functor5< Arg1, Arg2, Arg3, Arg4, Arg5 >
02394 memfn5( const Holder &holder, void (Object::*member)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) )
02395 {
02396    return Functor5< Arg1, Arg2, Arg3, Arg4, Arg5 >( new Impl::MemberFunctor5< Holder, Object, Arg1, Arg2, Arg3, Arg4, Arg5 >( holder, member ) );
02397 }
02398 
02399 template<class Functor>
02400 inline Functor5< CPPTL_TYPENAME Functor::first_argument_type
02401            ,CPPTL_TYPENAME Functor::second_argument_type
02402            ,CPPTL_TYPENAME Functor::arg3_type
02403            ,CPPTL_TYPENAME Functor::arg4_type
02404            ,CPPTL_TYPENAME Functor::arg5_type >
02405 fn5( Functor functor )
02406 {
02407    typedef CPPTL_TYPENAME Functor::first_argument_type Arg1;
02408    typedef CPPTL_TYPENAME Functor::second_argument_type Arg2;
02409    typedef CPPTL_TYPENAME Functor::arg3_type Arg3;
02410    typedef CPPTL_TYPENAME Functor::arg4_type Arg4;
02411    typedef CPPTL_TYPENAME Functor::arg5_type Arg5;
02412    return Functor5< Arg1, Arg2, Arg3, Arg4, Arg5 >( new Impl::GenericFunctor5< Functor, Arg1, Arg2, Arg3, Arg4, Arg5 >( functor ) );
02413 }
02414 
02415 template<class Functor, class BindArg>
02416 inline Impl::Bind5<Functor
02417            ,CPPTL_TYPENAME Functor::first_argument_type
02418            ,CPPTL_TYPENAME Functor::second_argument_type
02419            ,CPPTL_TYPENAME Functor::arg3_type
02420            ,CPPTL_TYPENAME Functor::arg4_type
02421            ,CPPTL_TYPENAME Functor::arg5_type
02422            ,BindArg >
02423 bind6( Functor functor, BindArg arg )
02424 {
02425    return Impl::Bind5<Functor
02426            ,CPPTL_TYPENAME Functor::first_argument_type
02427            ,CPPTL_TYPENAME Functor::second_argument_type
02428            ,CPPTL_TYPENAME Functor::arg3_type
02429            ,CPPTL_TYPENAME Functor::arg4_type
02430            ,CPPTL_TYPENAME Functor::arg5_type
02431            ,BindArg >( functor, arg );
02432 }
02433 
02434 template< class Functor, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
02435 inline Functor0
02436 bind( Functor functor, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 )
02437 {
02438     return fn0( bind1( bind2( bind3( bind4( bind5( functor, a5 ), a4 ), a3 ), a2 ), a1 ) );
02439 }
02440 
02441 template< class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class FA1, class FA2, class FA3, class FA4, class FA5 >
02442 inline Functor0
02443 bind_cfn( void (*function)( FA1, FA2, FA3, FA4, FA5 ), Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 )
02444 {
02445     return fn0( bind1( bind2( bind3( bind4( bind5( cfn5( function ), a5 ), a4 ), a3 ), a2 ), a1 ) );
02446 }
02447 
02448 template< class Holder, class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class FA1, class FA2, class FA3, class FA4, class FA5 >
02449 inline  Functor0
02450 bind_memfn( const Holder &holder,
02451              void (Object::*member)( FA1, FA2, FA3, FA4, FA5 ),
02452              Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 )
02453 {
02454     return fn0( bind1( bind2( bind3( bind4( bind5( memfn5( holder, member ), a5 ), a4 ), a3 ), a2 ), a1 ) );
02455 }
02456 
02457 // Functor5R
02458 
02459 template< class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
02460 inline Functor5R< Return, Arg1, Arg2, Arg3, Arg4, Arg5 > cfn5r( Return (*function)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) )
02461 {
02462    typedef Return (*Functor)(Arg1,Arg2,Arg3,Arg4,Arg5);
02463    return Functor5R< Return, Arg1, Arg2, Arg3, Arg4, Arg5 >( new Impl::GenericFunctor5R< Functor, Return, Arg1, Arg2, Arg3, Arg4, Arg5 >( function ) );
02464 }
02465 
02466 template< class Holder, class Object, class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
02467 inline Functor5R< Return, Arg1, Arg2, Arg3, Arg4, Arg5 >
02468 memfn5r( const Holder &holder, Return (Object::*member)( Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 ) )
02469 {
02470    return Functor5R< Return, Arg1, Arg2, Arg3, Arg4, Arg5 >( new Impl::MemberFunctor5R< Holder, Object, Return, Arg1, Arg2, Arg3, Arg4, Arg5 >( holder, member ) );
02471 }
02472 
02473 template<class Functor>
02474 inline Functor5R< CPPTL_TYPENAME Functor::result_type
02475            ,CPPTL_TYPENAME Functor::first_argument_type
02476            ,CPPTL_TYPENAME Functor::second_argument_type
02477            ,CPPTL_TYPENAME Functor::arg3_type
02478            ,CPPTL_TYPENAME Functor::arg4_type
02479            ,CPPTL_TYPENAME Functor::arg5_type >
02480 fn5r( Functor functor )
02481 {
02482    typedef CPPTL_TYPENAME Functor::result_type Return;
02483    typedef CPPTL_TYPENAME Functor::first_argument_type Arg1;
02484    typedef CPPTL_TYPENAME Functor::second_argument_type Arg2;
02485    typedef CPPTL_TYPENAME Functor::arg3_type Arg3;
02486    typedef CPPTL_TYPENAME Functor::arg4_type Arg4;
02487    typedef CPPTL_TYPENAME Functor::arg5_type Arg5;
02488    return Functor5R< Return, Arg1, Arg2, Arg3, Arg4, Arg5 >( new Impl::GenericFunctor5R< Functor, Return, Arg1, Arg2, Arg3, Arg4, Arg5 >( functor ) );
02489 }
02490 
02491 template<class Functor, class BindArg>
02492 inline Impl::Bind5R<Functor
02493            ,CPPTL_TYPENAME Functor::result_type
02494            ,CPPTL_TYPENAME Functor::first_argument_type
02495            ,CPPTL_TYPENAME Functor::second_argument_type
02496            ,CPPTL_TYPENAME Functor::arg3_type
02497            ,CPPTL_TYPENAME Functor::arg4_type
02498            ,CPPTL_TYPENAME Functor::arg5_type
02499            ,BindArg >
02500 bind6r( Functor functor, BindArg arg )
02501 {
02502    return Impl::Bind5R<Functor
02503            ,CPPTL_TYPENAME Functor::result_type
02504            ,CPPTL_TYPENAME Functor::first_argument_type
02505            ,CPPTL_TYPENAME Functor::second_argument_type
02506            ,CPPTL_TYPENAME Functor::arg3_type
02507            ,CPPTL_TYPENAME Functor::arg4_type
02508            ,CPPTL_TYPENAME Functor::arg5_type
02509            ,BindArg >( functor, arg );
02510 }
02511 
02512 template< class Functor, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5 >
02513 inline Functor0R<CPPTL_TYPENAME Functor::result_type>
02514 bindr( Functor functor, Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 )
02515 {
02516     return fn0r( bind1r( bind2r( bind3r( bind4r( bind5r( functor, a5 ), a4 ), a3 ), a2 ), a1 ) );
02517 }
02518 
02519 template< class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class FA1, class FA2, class FA3, class FA4, class FA5 >
02520 inline Functor0R<Return>
02521 bind_cfnr( Return (*function)( FA1, FA2, FA3, FA4, FA5 ), Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 )
02522 {
02523     return fn0r( bind1r( bind2r( bind3r( bind4r( bind5r( cfn5r( function ), a5 ), a4 ), a3 ), a2 ), a1 ) );
02524 }
02525 
02526 template< class Holder, class Object, class Return, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class FA1, class FA2, class FA3, class FA4, class FA5 >
02527 inline  Functor0R<Return>
02528 bind_memfnr( const Holder &holder,
02529              Return (Object::*member)( FA1, FA2, FA3, FA4, FA5 ),
02530              Arg1 a1, Arg2 a2, Arg3 a3, Arg4 a4, Arg5 a5 )
02531 {
02532     return fn0r( bind1r( bind2r( bind3r( bind4r( bind5r( memfn5r( holder, member ), a5 ), a4 ), a3 ), a2 ), a1 ) );
02533 }
02534 
02535 
02536 
02537 
02538 } // namespace CppTL
02539 
02540 
02541 #endif // CPPTL_FUNCTOR_H_INCLUDED
02542 
02543 

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers