I\'m writing a template class and at one point in my code would like to be able to value-initialize an object of the parameterized type on the stack. Right now, I\'m accomp
No, there isn't any other way to reliably value-initialize a template type in C++03.
If you can count on T only being class types with default constructors, you could just write
T valueInitialized;
but if T might as well be a built-in type,
T valueInitialized = T();
is the way to go.
Do you have any reason to not to trust your compiler to optimize away that copy?