error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'void (__thiscall CRenderer::* )(void)'
Thanks for any help.
Overloaded functions
I would search for this but the GD.net search feature is still broken :(
How are overloaded C++ functions supposed to be handled when using RegisterObjectMethod? Currently I get the compile error:
You register a wrapper for the function, and register the wrappers as far as i know. I've thought about how it would be nice to be able to get the address of an overloaded function but i do not know how.
static double FloatIPow(float x, int y){ return pow(x, y);}static double FloatFPow(float x, float y){ return pow(x, y);}static double DoubleIPow(double x, int y){ return pow(x, y);}static double DoubleDPow(double x, double y){ return pow(x, y);}
You need to use the macro asFUNCTIONPR(func, paramlist, rettype) or asMETHODPR(class, method, paramlist, rettype). For example:
What the macro does is that it tells C++ exactly what overloaded function you wish to take the address of. It expands to:
asFUNCTIONPR(print, (string&), void) => (void (*)(string&))print
void print(float);void print(string&);void print(int);engine->RegisterGlobalFunction("void print(float)", asFUNCTIONPR(print,(float),void), asCALL_CDECL);engine->RegisterGlobalFunction("void print(string∈)", asFUNCTIONPR(print,(string&),void), asCALL_CDECL);engine->RegisterGlobalFunction("void print(int)", asFUNCTIONPR(print,(int),void), asCALL_CDECL);
What the macro does is that it tells C++ exactly what overloaded function you wish to take the address of. It expands to:
asFUNCTIONPR(print, (string&), void) => (void (*)(string&))print
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement