[C++-sig] Can't use make_function to wrap base class method? (original) (raw)
Alex Mohr amohr at pixar.com
Thu Dec 15 19:58:37 CET 2005
- Previous message: [C++-sig] Can't use make_function to wrap base class method?
- Next message: [C++-sig] python in console game development?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
You either need to wrap Base or you need to
.def( "method", makefunction( (int (Derived::*)()) &Derived::method ) ) class has the information about the derived class (it's a template argument), so it can do the cast automagically. However, makefunction is just a function, so it can't do anything fancy with Derived. The function pointer's type is int (Base::*)() even when you get it via &Derived::method.
Ahh, that makes perfect sense. Thanks! Does it make sense to add something like:
make_method(&Derived::method)
Which would just call make_function with the appropriate cast? Perhaps I could give it a shot if it seems like a good idea. Or perhaps it would be better to have a form of make_function like this?
Alex
- Previous message: [C++-sig] Can't use make_function to wrap base class method?
- Next message: [C++-sig] python in console game development?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]