Click here to Skip to main content
12,357,063 members (76,135 online)

C / C++ / MFC

 
AnswerRe: SendMessage(...) MFC is not working in win 7 enterprise edition Pin
vikuseth14-Nov-12 1:04
membervikuseth14-Nov-12 1:04 
QuestionDoes this way to clear all item from std::map have problem? Pin
yu-jian11-Nov-12 1:47
groupyu-jian11-Nov-12 1:47 
AnswerRe: Does this way to clear all item from std::map have problem? Pin
Richard MacCutchan11-Nov-12 6:18
mvpRichard MacCutchan11-Nov-12 6:18 
GeneralRe: Does this way to clear all item from std::map have problem? Pin
yu-jian11-Nov-12 19:50
groupyu-jian11-Nov-12 19:50 
Hi,

Thank you for your replay, after see this article, I find that I am right.
Thankyou a lot.

#include "stdafx.h"

#include <list>
#include <iostream>

int main( ) 
{
	using namespace std;
	list <int> c1;
	list <int>::iterator Iter;
 
	c1.push_back( 10 );
	c1.push_back( 20 );
	c1.push_back( 30 );
	c1.push_back( 40 );
	c1.push_back( 50 );
	cout << "The initial list is:";
	for ( Iter = c1.begin( ); Iter != c1.end( ); Iter++ )
		cout << " " << *Iter;
	cout << endl;
 
	std::list<int>::iterator iter;
	std::list<int>::iterator iter2Delete;
	for(iter = c1.begin(); iter != c1.end();)
	{
		iter2Delete = iter++;
		c1.erase(iter2Delete);
	}
 
	for (Iter = c1.begin( ); Iter != c1.end( ); Iter++ )
		cout << " " << *Iter;
	cout << endl;
}

GeneralRe: Does this way to clear all item from std::map have problem? Pin
Richard MacCutchan11-Nov-12 21:35
mvpRichard MacCutchan11-Nov-12 21:35 
GeneralRe: Does this way to clear all item from std::map have problem? Pin
Stephen Hewitt12-Nov-12 1:43
memberStephen Hewitt12-Nov-12 1:43 
GeneralRe: Does this way to clear all item from std::map have problem? Pin
yu-jian12-Nov-12 3:06
groupyu-jian12-Nov-12 3:06 
QuestionGetting pasted test Pin
Hadi Dayvary10-Nov-12 4:20
memberHadi Dayvary10-Nov-12 4:20 
AnswerRe: Getting pasted test Pin
Richard MacCutchan10-Nov-12 6:05
mvpRichard MacCutchan10-Nov-12 6:05 
GeneralRe: Getting pasted test Pin
Hadi Dayvary10-Nov-12 20:29
memberHadi Dayvary10-Nov-12 20:29 

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.


Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 29 Jun 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid