Click here to Skip to main content
15,912,897 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: assignment operator for CDBVariant Pin
Try25-Feb-07 21:31
Try25-Feb-07 21:31 
AnswerRe: assignment operator for CDBVariant Pin
prasad_som25-Feb-07 21:38
prasad_som25-Feb-07 21:38 
GeneralRe: assignment operator for CDBVariant Pin
prithaa25-Feb-07 22:03
prithaa25-Feb-07 22:03 
AnswerRe: assignment operator for CDBVariant Pin
prasad_som25-Feb-07 22:10
prasad_som25-Feb-07 22:10 
GeneralRe: assignment operator for CDBVariant Pin
Cedric Moonen25-Feb-07 22:17
Cedric Moonen25-Feb-07 22:17 
Questionvideo compression Pin
viliam25-Feb-07 21:11
viliam25-Feb-07 21:11 
AnswerRe: video compression Pin
Russell'26-Feb-07 7:41
Russell'26-Feb-07 7:41 
AnswerRe: video compression Pin
KaЯl27-Feb-07 4:13
KaЯl27-Feb-07 4:13 
QuestionStatic Text control. Pin
Sameer_Thakur25-Feb-07 20:13
Sameer_Thakur25-Feb-07 20:13 
AnswerRe: Static Text control. Pin
prasad_som25-Feb-07 20:39
prasad_som25-Feb-07 20:39 
AnswerRe: Static Text control. Pin
Try25-Feb-07 20:59
Try25-Feb-07 20:59 
AnswerRe: Static Text control. Pin
David Crow26-Feb-07 9:11
David Crow26-Feb-07 9:11 
QuestionCString problem Pin
david bagaturia25-Feb-07 20:11
david bagaturia25-Feb-07 20:11 
AnswerRe: CString problem Pin
Nibu babu thomas25-Feb-07 20:18
Nibu babu thomas25-Feb-07 20:18 
GeneralRe: CString problem Pin
david bagaturia25-Feb-07 20:59
david bagaturia25-Feb-07 20:59 
AnswerRe: CString problem Pin
Try25-Feb-07 20:20
Try25-Feb-07 20:20 
GeneralRe: CString problem Pin
david bagaturia25-Feb-07 21:04
david bagaturia25-Feb-07 21:04 
QuestionHow to create a new document template that does not have Frame/View Pin
Nataraj197825-Feb-07 19:56
Nataraj197825-Feb-07 19:56 
QuestionHow to show my program in context menu Pin
Max++25-Feb-07 19:55
Max++25-Feb-07 19:55 
AnswerRe: How to show my program in context menu Pin
Michael Dunn25-Feb-07 20:34
sitebuilderMichael Dunn25-Feb-07 20:34 
GeneralRe: How to show my program in context menu Pin
prasad_som25-Feb-07 20:37
prasad_som25-Feb-07 20:37 
AnswerRe: How to show my program in context menu Pin
prasad_som25-Feb-07 20:35
prasad_som25-Feb-07 20:35 
QuestionPreventing dangling pointers Pin
Waldermort25-Feb-07 19:53
Waldermort25-Feb-07 19:53 
AnswerRe: Preventing dangling pointers Pin
Cedric Moonen25-Feb-07 20:31
Cedric Moonen25-Feb-07 20:31 
And what is the problem exactly ? Because classA now holds a pointer that points to invalid memory ?
You said that DeleteAll is called at program termination, so what is the problem exactly ?

Anyway, what you could do, is to wrap your structure in a smart pointer. A smart pointer is a class that owns a pointer to a dynamically allocated object. It overload the -> and * operators so that you can use it as if you were using the nested object directly. The purpose of smart pointers is that they will destroy automatically the object as soon as nobody use it anymore. There is a reference counting in the smart counter and this ref counting is shared across all instances of the 'same' smart pointer (by same I mean the smart pointers that hold the same pointer). You can copy the smart pointer for example (this will increment the ref counting)...

There is a smart pointer class in the boost library. Take a look here[^] for a nice article about it.


Cédric Moonen
Software developer

Charting control [v1.1]

GeneralRe: Preventing dangling pointers Pin
Waldermort25-Feb-07 20:39
Waldermort25-Feb-07 20:39 

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.