There is no such thing as the maximum size of a template class, especially if that class contains an instance of the template argument, as yours does. Consider each of
template <typename T> class MyClass {
public:
MyClass() { };
MyClass(T& t) : _t(t) { }
private:
T _t;
};
union TestUnion {
MyClass<char>;
MyClass<unsigned char>;
MyClass<signed char>;
MyClass<short>;
// ...
MyClass<float>;
MyClass<double>;
MyClass<char*>;
MyClass<int*>;
// ...
MyClass<void*>;
MyClass<void (*)(void)>;
MyClass<std::vector>;
// ...
MyClass<int[10]>;
MyClass<int[100]>;
MyClass<int[1000]>;
MyClass<int[10000]>;
MyClass<int[100000]>;
};
and so on... Or equally excitingly, insert
MyClass< MyClass< MyClass< ... < XImage > ... > > >
(which is admittedly not guaranteed to work at greater than the promised maximum nested template instantiation depth (17 now, 1024 soon)).
So, clearly there's no theoretical maximum. If you have a universe of types in mind that will actually be template parameters to MyClass<>, then it might be do-able.
EDIT -- replaced < with <
so the template argument wouldn't be hidden by the SO parser.