Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5828 for code/branches/core5


Ignore:
Timestamp:
Sep 28, 2009, 9:14:00 PM (15 years ago)
Author:
landauf
Message:

Overloaded createFunctor for FunctorMember<T> with a second argument "T* object" which serves as the object for a member-function.

These are equivalent:

  • createFunctor(&A::f, pointer);
  • createFunctor(&A::f)→setObject(pointer);
  • FunctorMember<A>* functor = createFunctor(&A::f); functor→setObject(pointer);
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/libraries/core/Functor.h

    r5738 r5828  
    434434    { \
    435435        return new FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
     436    } \
     437    \
     438    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
     439    inline FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)), T* object) \
     440    { \
     441        FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* functor = new FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
     442        functor->setObject(object); \
     443        return functor; \
     444    } \
     445    \
     446    \
     447    FUNCTOR_TEMPLATE(1, returnvalue, numparams) \
     448    inline FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const, T* object) \
     449    { \
     450        FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* functor = new FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \
     451        functor->setObject(object); \
     452        return functor; \
    436453    }
    437454
Note: See TracChangeset for help on using the changeset viewer.