This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

static function pointers in C++ template class


Hi,
I'm trying to figure out the proper syntax for setting static member
variables of a C++ template class that are function pointers.  The
warnings from gcc don't really give any insight and a search of the
web turns up things that are close but not quite what I'm looking for.
Here's the code:

template <class T>
class udata
{
	public:	

                 //stuff
	
	protected:
		static void (*kill_func)(T);   //my function pointer
};

//create specializations as well a general case
template <class T>
void (udata<T>::*kill_func)(T) = free;

template <dWorldID>
void (udata<dWorldID>::*kill_func)(dWorldID) = dWorldDestroy;

template <dSpaceID>
void (udata<dSpaceID>::*kill_func)(dSpaceID) = dSpaceDestroy;

The errors I'm getting are:

/Users/wesleysmith/jit.gl.lua_beta1/Lua_dev/ODE_Package/lua_ode_udata.h:62:
error: template declaration of 'void (udata<T>::* kill_func)(T)'
/Users/wesleysmith/jit.gl.lua_beta1/Lua_dev/ODE_Package/lua_ode_udata.h:65:
error: template declaration of 'void (udata<dxWorld*>::*
kill_func)(dxWorld*)'
/Users/wesleysmith/jit.gl.lua_beta1/Lua_dev/ODE_Package/lua_ode_udata.h:68:
error: template declaration of 'void (udata<dxSpace*>::*
kill_func)(dxSpace*)'

where dxSpace* is the same as dSpaceID and dxWorld* is the same as dWorldID

Where is my syntax going wrong?

thanks,
wes


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]