Meditation, The Art of Exploitation

Thinking? At last I have discovered it--thought; this alone is inseparable from me. I am, I exist--that is certain. But for how long? For as long as I am thinking. For it could be, that were I totally to cease from thinking, I should totally cease to exist....I am, then, in the strict sense only a thing that thinks.

Thursday, July 05, 2007

C++ static template class member variable

C++ can be wierd. A non-template class member variable when declared static needs to be instantiated in a link unit e.g.

struct A{
static int a;
};

int A::a;

For a template class, it can get wierd:
template < typename T>
struct A{
static int a;
};

template < typname T>
int A< T>::a;