Click here to Skip to main content
15,890,982 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: opaque pointer Pin
Maxwell Chen13-Mar-08 19:04
Maxwell Chen13-Mar-08 19:04 
GeneralRe: opaque pointer Pin
George_George13-Mar-08 14:50
George_George13-Mar-08 14:50 
GeneralRe: opaque pointer Pin
Maxwell Chen13-Mar-08 9:25
Maxwell Chen13-Mar-08 9:25 
GeneralRe: opaque pointer Pin
George_George13-Mar-08 14:57
George_George13-Mar-08 14:57 
GeneralRe: opaque pointer Pin
Maxwell Chen13-Mar-08 19:09
Maxwell Chen13-Mar-08 19:09 
AnswerRe: opaque pointer Pin
Maxwell Chen13-Mar-08 19:13
Maxwell Chen13-Mar-08 19:13 
GeneralRe: opaque pointer Pin
George_George13-Mar-08 19:21
George_George13-Mar-08 19:21 
Questionconstructor for POD types? Pin
George_George12-Mar-08 15:51
George_George12-Mar-08 15:51 
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.

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
AnswerRe: constructor for POD types? Pin
Michael Dunn12-Mar-08 19:20
sitebuilderMichael Dunn12-Mar-08 19:20 
GeneralRe: constructor for POD types? Pin
George_George12-Mar-08 19:35
George_George12-Mar-08 19:35 
GeneralRe: constructor for POD types? Pin
Michael Dunn16-Mar-08 16:08
sitebuilderMichael Dunn16-Mar-08 16:08 
GeneralRe: constructor for POD types? Pin
George_George16-Mar-08 16:31
George_George16-Mar-08 16:31 
GeneralRe: constructor for POD types? Pin
Michael Dunn16-Mar-08 16:38
sitebuilderMichael Dunn16-Mar-08 16:38 
GeneralRe: constructor for POD types? Pin
George_George16-Mar-08 16:42
George_George16-Mar-08 16:42 
GeneralRe: constructor for POD types? Pin
Michael Dunn16-Mar-08 16:57
sitebuilderMichael Dunn16-Mar-08 16:57 
GeneralRe: constructor for POD types? Pin
George_George16-Mar-08 22:50
George_George16-Mar-08 22:50 
Questionresource leak in this case? Pin
George_George12-Mar-08 14:54
George_George12-Mar-08 14:54 
AnswerRe: resource leak in this case? Pin
Eytukan12-Mar-08 15:35
Eytukan12-Mar-08 15:35 
GeneralRe: resource leak in this case? Pin
George_George12-Mar-08 16:15
George_George12-Mar-08 16:15 
AnswerRe: resource leak in this case? Pin
Rajkumar R12-Mar-08 21:36
Rajkumar R12-Mar-08 21:36 
GeneralRe: resource leak in this case? Pin
George_George12-Mar-08 21:43
George_George12-Mar-08 21:43 
QuestionRe: resource leak in this case? Pin
Rajkumar R12-Mar-08 21:50
Rajkumar R12-Mar-08 21:50 
GeneralRe: resource leak in this case? Pin
George_George12-Mar-08 21:53
George_George12-Mar-08 21:53 
AnswerRe: resource leak in this case? Pin
KarstenK12-Mar-08 22:11
mveKarstenK12-Mar-08 22:11 
GeneralRe: resource leak in this case? Pin
George_George12-Mar-08 22:31
George_George12-Mar-08 22:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.