first post here ;)
what kind of types are allowed as template parameters in c++?
what i need is a template class taking a known pointer-to-classmember as a compile-time parameter, like:
typedef int MyClass::* member_pointer;
template <member_pointer pm>
class NotWorking
{
void func(MyClass* pClass)
{
pClass->*pm = 1;
}
};
void test
{
NotWorking< &MyClass::var1 > compile_error;
}
This doesn't work ( VS2003.NET )...
Still c++ *is* able to have pointers, whose addresses are known at compile-time, as template parameters. Obviously &MyClass::var1 should be known at compile-time... so is this a VS2003.NET bug? or is there a nice workaround? or what am i doing wrong?
Thx
ElOmmy











