I'm trying to get the maximum size of any possible instance of my template as a compile time constant. The first thing that came to mind was something like this...
union TestUnion
{
template<typename T> class MyClass
{
public:
MyClass() { };
MyClass(T& t) : _t(t) { }
private:
T _t;
};
};
But sizeof(TestUnion)
is always equal to 1, but sizeof(MyClass<int>)
for instance, correctly returns 4. Anyone have any better ideas?