Click here to Skip to main content
16,005,181 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralGetting floppy drive info Pin
Brigg Thorp18-Oct-01 3:10
Brigg Thorp18-Oct-01 3:10 
GeneralRe: Getting floppy drive info Pin
Jon Hulatt18-Oct-01 4:58
Jon Hulatt18-Oct-01 4:58 
QuestionMFC DAO - Portable? Pin
Simon Walton18-Oct-01 2:36
Simon Walton18-Oct-01 2:36 
AnswerRe: MFC DAO - Portable? Pin
Christian Graus18-Oct-01 3:03
protectorChristian Graus18-Oct-01 3:03 
AnswerRe: MFC DAO - Portable? Pin
kumar_p318-Oct-01 3:04
kumar_p318-Oct-01 3:04 
GeneralRe: MFC DAO - Portable? Pin
Simon Walton18-Oct-01 7:20
Simon Walton18-Oct-01 7:20 
GeneralRe: MFC DAO - Portable? Pin
Carlos Antollini18-Oct-01 8:05
Carlos Antollini18-Oct-01 8:05 
GeneralReusing a std::vector<> object after performing an erase() Pin
Franz Klein18-Oct-01 2:36
Franz Klein18-Oct-01 2:36 
I am using a std::vector object to contain data that I need when creating
and displaying a graph. Initially the std::vector object is empty when
created. As information is retrieved it is push_back() onto the std::vector.
The std::vector object is declared in a CDocument object. When a CScrollView
is displayed the information is retrieved from the std::vector object. On
closure of the CScrollView the std::vector object is erased in
CDocument::CanCloseFrame().

The problem lies in reusing the std::vector object after it is erase(). An
error occurs when trying to perform a push_back().

The code is as follows:

In CDocument -
std::vector<edge> m_graphedge;

In CDocument::CanCloseFrame() -
m_graphedge.erase(m_graphedge.begin(), m_graphedge.end());

In CDocument::CreateGraph() -
m_graphedge.push_back(anedge); //works for the first time before it is
erased in CanCloseFrame();
//but doesn't work
after m_graphedge.erase() is called.
//HELP ???

Anybody with a solution?

Thank you Smile | :)
Franz Klein
GeneralRe: Reusing a std::vector<> object after performing an erase() Pin
Christian Graus18-Oct-01 3:07
protectorChristian Graus18-Oct-01 3:07 
GeneralRe: Reusing a std::vector<> object after performing an erase() Pin
Franz Klein18-Oct-01 4:12
Franz Klein18-Oct-01 4:12 
GeneralRe: Reusing a std::vector<> object after performing an erase() Pin
Tomasz Sowinski18-Oct-01 4:30
Tomasz Sowinski18-Oct-01 4:30 
GeneralRe: Reusing a std::vector<> object after performing an erase() Pin
Mike Burston18-Oct-01 13:05
Mike Burston18-Oct-01 13:05 
GeneralRe: Reusing a std::vector<> object after performing an erase() Pin
George Anescu18-Oct-01 5:29
George Anescu18-Oct-01 5:29 
GeneralColored Rectangles as background Pin
18-Oct-01 2:33
suss18-Oct-01 2:33 
GeneralRe: Colored Rectangles as background Pin
kumar_p318-Oct-01 3:01
kumar_p318-Oct-01 3:01 
Generala question Pin
The_Server18-Oct-01 2:27
The_Server18-Oct-01 2:27 
GeneralRe: a question Pin
Andres Manggini18-Oct-01 7:12
Andres Manggini18-Oct-01 7:12 
GeneralRe: Or use WinSock API! Pin
Masaaki Onishi18-Oct-01 8:39
Masaaki Onishi18-Oct-01 8:39 
GeneralRe: a question Pin
Net Guy18-Oct-01 9:32
Net Guy18-Oct-01 9:32 
GeneralRe: a question Pin
The_Server21-Oct-01 1:00
The_Server21-Oct-01 1:00 
GeneralDynamic CMenu* Pin
Chambers18-Oct-01 1:03
Chambers18-Oct-01 1:03 
GeneralRe: Dynamic CMenu* Pin
Jon Hulatt18-Oct-01 1:40
Jon Hulatt18-Oct-01 1:40 
GeneralRe: Dynamic CMenu* Pin
kumar_p318-Oct-01 2:17
kumar_p318-Oct-01 2:17 
Generaldropdown toolbars when writing a shell namespace extension Pin
18-Oct-01 0:42
suss18-Oct-01 0:42 
GeneralConverting a CString into a CPoint Pin
18-Oct-01 0:37
suss18-Oct-01 0:37 

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.