Click here to Skip to main content
15,913,709 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionVista using System32/MSVCRT.DLL Pin
benny232313-Mar-07 4:25
benny232313-Mar-07 4:25 
AnswerRe: Vista using System32/MSVCRT.DLL Pin
James R. Twine13-Mar-07 5:07
James R. Twine13-Mar-07 5:07 
Questioninsert for STL Pin
prithaa13-Mar-07 3:47
prithaa13-Mar-07 3:47 
AnswerRe: insert for STL Pin
toxcct13-Mar-07 3:49
toxcct13-Mar-07 3:49 
GeneralRe: insert for STL Pin
prithaa13-Mar-07 7:10
prithaa13-Mar-07 7:10 
GeneralRe: insert for STL Pin
toxcct13-Mar-07 7:55
toxcct13-Mar-07 7:55 
GeneralRe: insert for STL Pin
prithaa13-Mar-07 8:01
prithaa13-Mar-07 8:01 
GeneralRe: insert for STL Pin
toxcct13-Mar-07 8:09
toxcct13-Mar-07 8:09 
class CRICH {};
 
vector<CRICH*> m_table;
CRICH *CRICHobj = new CRICH;
m_table.push_back(CRICHobj);

the danger with with a vector of pointer (rather than a pointer of objects, is that you have to be very careful with memory leaks.
when removing an element from the vector, you should always think to delete it.
for instance, when cleaning the vector:
vector<CRICH*>::iterator it;
 
for (it = m_table.begin(); it != m_table.end(); it++) {
    delete(*it);
}
m_table.clear();


the best is still to declare a vector<CRICH> m_table (by object), and then, only add objects like this :
CRICH CRICHobj = CRICH();
m_table.push_back(CRICHobj);

then, no need to care about deletes, and you can just do a m_table.clear()


GeneralRe: insert for STL Pin
prithaa13-Mar-07 8:15
prithaa13-Mar-07 8:15 
GeneralRe: insert for STL Pin
toxcct13-Mar-07 8:21
toxcct13-Mar-07 8:21 
GeneralRe: insert for STL Pin
prithaa13-Mar-07 8:27
prithaa13-Mar-07 8:27 
GeneralRe: insert for STL Pin
Maximilien13-Mar-07 8:32
Maximilien13-Mar-07 8:32 
GeneralRe: insert for STL Pin
prithaa13-Mar-07 8:49
prithaa13-Mar-07 8:49 
QuestionCCheckListBox and static linking Pin
Magonnew13-Mar-07 3:36
Magonnew13-Mar-07 3:36 
AnswerRe: CCheckListBox and static linking Pin
David Crow13-Mar-07 6:03
David Crow13-Mar-07 6:03 
GeneralRe: CCheckListBox and static linking Pin
Magonnew13-Mar-07 20:48
Magonnew13-Mar-07 20:48 
QuestionHow to use AppendFormatV using win32 but not MFC Pin
Mushtaque Nizamani13-Mar-07 2:45
Mushtaque Nizamani13-Mar-07 2:45 
QuestionRe: How to use AppendFormatV using win32 but not MFC Pin
David Crow13-Mar-07 2:48
David Crow13-Mar-07 2:48 
AnswerRe: How to use AppendFormatV using win32 but not MFC Pin
James R. Twine13-Mar-07 2:51
James R. Twine13-Mar-07 2:51 
QuestionWindows Vista Pin
San246813-Mar-07 2:41
San246813-Mar-07 2:41 
AnswerRe: Windows Vista Pin
David Crow13-Mar-07 2:45
David Crow13-Mar-07 2:45 
GeneralRe: Windows Vista Pin
San246813-Mar-07 2:57
San246813-Mar-07 2:57 
QuestionRe: Windows Vista Pin
David Crow13-Mar-07 3:05
David Crow13-Mar-07 3:05 
GeneralRe: Windows Vista Pin
Maximilien13-Mar-07 3:19
Maximilien13-Mar-07 3:19 
AnswerRe: Windows Vista Pin
Maximilien13-Mar-07 3:03
Maximilien13-Mar-07 3:03 

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.