Jump to content
  • Advertisement
Sign in to follow this  
Dragon_Strike

default argument to template function pointer

This topic is 3732 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i want to do some class template specialization... but im unsure how i would do the following... class Nulltype{}; template <class T, class Object = NullType, typename T (Object::*real_getter)() = ???> class ROProperty; template <class T> class ROProperty<T, NullType, ???? >

Share this post


Link to post
Share on other sites
Advertisement
You could look up boost::bind or you could:

Quote:
Originally posted from http://www.newty.de/fpt/fpt.html#defi

// Solution using a typedef: Define a pointer to a function which is taking
// two floats and returns a float
typedef float(*pt2Func)(float, float);

pt2Func GetPtr2(const char opCode)
{
    if(opCode == '+')
        return &Plus;
    else
        return &Minus; // default if invalid operator was passed
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!