constructor for POD types?

Joined
Feb 12, 2008
Messages
108
Reaction score
0
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top