static function pointers in C++ template class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux