Hello everyone,
When implementing a general template class, sometimes we call T() -- suppose T is type argument of a template class.
My questions,
1. what will happen if T is POD type? Do nothing?
2. Is it good code? Or working but not good code?
Here is my test code, works in MSVC 2008.
Code:template <class T> class Foo { public: void static test() { T(); // call constructor for any type, including POD? } }; int main() { Foo<int> g; g.test(); return 0; }
thanks in advance,
George