Jump to content
  • Advertisement
Sign in to follow this  

default argument to template function pointer

This topic is 3911 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
You could look up boost::bind or you could:

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;
        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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!