I have and header with a template class, which has only static functions and fields.
template<typename T> class Luaproxy {
static std::map<std::string, fieldproxy> fields;
static const char * const CLASS_NAME;
static void addfields();
static int __newindex(lua_State * l){
//implemented stuff, references to fields...
}
//etc
}
As you can see some of the functions are only declared, because I intend to implement them with template specialization.
In a .ccp file I have:
struct test { int a; }
template<> map<string, fieldproxy> Luaproxy<test>::fields;
template<> const char * const Luaproxy<test>::CLASS_NAME=typeid(test).name();
template<> void Luaproxy<test>::addfields(){
//stuff, references to fields...
}
I get undefined reference errors to Luaproxy<test>::fields
from both functions that are implemented in the header and those that are only specialized in the .cpp. Note that Luaproxy<test>::CLASS_NAME
and Luaproxy<test>::addfields
seem to be found in linking.
What makes that map
so special?