Click here to Skip to main content
15,916,379 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Strange problem with CString Pin
Ravi Bhavnani23-Jun-04 7:06
professionalRavi Bhavnani23-Jun-04 7:06 
GeneralRe: Strange problem with CString Pin
jmkhael23-Jun-04 7:08
jmkhael23-Jun-04 7:08 
GeneralRe: Strange problem with CString Pin
David Crow23-Jun-04 7:11
David Crow23-Jun-04 7:11 
GeneralRe: Strange problem with CString Pin
jmkhael23-Jun-04 7:13
jmkhael23-Jun-04 7:13 
GeneralRe: Strange problem with CString Pin
David Crow23-Jun-04 7:07
David Crow23-Jun-04 7:07 
GeneralRe: Strange problem with CString Pin
rrrado23-Jun-04 20:57
rrrado23-Jun-04 20:57 
GeneralC++ STL help... using pointer in STL map Pin
Indrawati22-Jun-04 23:36
Indrawati22-Jun-04 23:36 
GeneralRe: C++ STL help... using pointer in STL map Pin
Johnny ²23-Jun-04 3:09
Johnny ²23-Jun-04 3:09 
Yes, a temporary A object will be created (pTmp), and the m_mA.insert will make a copy of this - you will have two objects constructed, with pTmp being destructed once it goes out of scope. Depending how you obtain the pixel data in class A (you didnt provide details of this), then the destruction of pTmp may, or may not, invalidate the A that was inserted into m_mA.

You could define a copy constructor, but it will be tricky to ensure that the memory is deallocated at the appropriate time. A better solution would be to use something like Boost shared_ptr[^], and dynamically allocate the A objects and get the SmartPtr to handle deallocation.

<br />
typedef boost::shared_ptr<A> APtr;<br />
typedef std::map<int,APtr>   MyMap;<br />
<br />
m_mA[id] = APtr (new A);<br />


This way there is no copying of objects, only of pointers. Not only will it be more efficient, but the SmartPtr will ensure that the class is destroyed once it is no longer used.
GeneralRe: C++ STL help... using pointer in STL map Pin
Anonymous23-Jun-04 14:20
Anonymous23-Jun-04 14:20 
QuestionHow to Enable/Disable the hibernation support in VC++ Pin
ErisonWu22-Jun-04 21:57
ErisonWu22-Jun-04 21:57 
GeneralChange cursor in a region of a CStatic Pin
doctorpi22-Jun-04 21:52
doctorpi22-Jun-04 21:52 
GeneralRe: Change cursor in a region of a CStatic Pin
Johan Rosengren22-Jun-04 22:21
Johan Rosengren22-Jun-04 22:21 
Questionhow to find all folders which are shared fully in my drive??? Pin
ngocdq22-Jun-04 21:34
ngocdq22-Jun-04 21:34 
AnswerRe: how to find all folders which are shared fully in my drive??? Pin
shri_3120-Sep-04 3:26
shri_3120-Sep-04 3:26 
GeneralCalling a C++ dll in VB with strucures &amp; strings Pin
Cedric Moonen22-Jun-04 21:21
Cedric Moonen22-Jun-04 21:21 
GeneralRe: Calling a C++ dll in VB with strucures & strings Pin
Antony M Kancidrowski22-Jun-04 23:22
Antony M Kancidrowski22-Jun-04 23:22 
GeneralSelect File Control. Pin
zooosta22-Jun-04 20:52
zooosta22-Jun-04 20:52 
GeneralRe: Select File Control. Pin
V.22-Jun-04 21:24
professionalV.22-Jun-04 21:24 
GeneralRe: Select File Control. Pin
zooosta23-Jun-04 13:10
zooosta23-Jun-04 13:10 
GeneralRegQueryValueEx Pin
22-Jun-04 20:16
suss22-Jun-04 20:16 
GeneralRe: RegQueryValueEx Pin
Sir.Ixildore22-Jun-04 20:38
Sir.Ixildore22-Jun-04 20:38 
QuestionHow to change caption of a button on a property page? Pin
Rajesh_K_Sharma22-Jun-04 19:29
Rajesh_K_Sharma22-Jun-04 19:29 
AnswerRe: How to change caption of a button on a property page? Pin
Antony M Kancidrowski22-Jun-04 23:34
Antony M Kancidrowski22-Jun-04 23:34 
Generalalert messages Pin
ask_you22-Jun-04 19:12
ask_you22-Jun-04 19:12 
GeneralRe: alert messages Pin
bneacetp22-Jun-04 19:23
bneacetp22-Jun-04 19:23 

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.