Click here to Skip to main content
15,885,914 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionUsing ON_UPDATE_COMMAND_UI Macro?? Pin
Arrin13-Jul-11 21:40
Arrin13-Jul-11 21:40 
AnswerRe: Using ON_UPDATE_COMMAND_UI Macro?? Pin
Richard MacCutchan13-Jul-11 21:55
mveRichard MacCutchan13-Jul-11 21:55 
AnswerRe: Using ON_UPDATE_COMMAND_UI Macro?? Pin
Nuri Ismail13-Jul-11 22:01
Nuri Ismail13-Jul-11 22:01 
QuestionHow to get the client's abort message with WSAAsyncSelect ? Pin
wangningyu13-Jul-11 15:30
wangningyu13-Jul-11 15:30 
AnswerRe: How to get the client's abort message with WSAAsyncSelect ? Pin
Member 131329513-Jul-11 18:32
Member 131329513-Jul-11 18:32 
AnswerRe: How to get the client's abort message with WSAAsyncSelect ? Pin
includeh1014-Jul-11 9:44
includeh1014-Jul-11 9:44 
GeneralRe: How to get the client's abort message with WSAAsyncSelect ? Pin
wangningyu14-Jul-11 15:25
wangningyu14-Jul-11 15:25 
Question[Solved] Passing an element from a list [modified] Pin
crgmustang13-Jul-11 13:50
crgmustang13-Jul-11 13:50 
Hello,
I have a program with a list of structs which I am iterating over. I would like to pass the individual structs to another function as I iterate over them but I can't seem to figure out how to do it. I'm new to working with lists and iterators so there is probably an easy way to do this but I couldn't find any reference to it in Google searches or a search of this forum.

Here is an example of what I would like to do:
struct MyStruct{
    int int1;
    bool bool1;
};

void MyFunction(MyStruct myStruct)
{
	cout << myStruct.bool1 << endl;
}

int _tmain(int argc, _TCHAR* argv[])
{
	list<MyStruct> structList;
	list<MyStruct>::iterator structIterator;
	
	MyStruct myStruct;
	MyStruct myStruct2;

	myStruct.int1 = 2;
	myStruct.bool1 = true;

	myStruct2.bool1 = false;
	myStruct2.int1 = 5;

	structList.push_back(myStruct);
	structList.push_back(myStruct2);

	structIterator = structList.begin();

	while (structIterator != structList.end())
	{
		MyFunction(structIterator);  
		structIterator++;
	}
	return 0;
}


Apparently structIterator points to the actual struct but I don't see how to get to it from here. Any help is greatly appreciated.
Thanks,
Craig

modified on Thursday, July 14, 2011 11:25 AM

AnswerRe: Passing an element from a list Pin
«_Superman_»13-Jul-11 14:48
professional«_Superman_»13-Jul-11 14:48 
GeneralRe: Passing an element from a list Pin
crgmustang14-Jul-11 5:28
crgmustang14-Jul-11 5:28 
QuestionPointer Maths Pin
KeithF12-Jul-11 3:25
KeithF12-Jul-11 3:25 
AnswerRe: Pointer Maths [modified] Pin
Stefan_Lang12-Jul-11 3:52
Stefan_Lang12-Jul-11 3:52 
GeneralRe: Pointer Maths Pin
Legor12-Jul-11 4:02
Legor12-Jul-11 4:02 
GeneralRe: Pointer Maths Pin
Stefan_Lang12-Jul-11 4:16
Stefan_Lang12-Jul-11 4:16 
AnswerRe: Pointer Maths Pin
Legor12-Jul-11 3:55
Legor12-Jul-11 3:55 
GeneralRe: Pointer Maths Pin
Rick York13-Jul-11 18:39
mveRick York13-Jul-11 18:39 
GeneralRe: Pointer Maths Pin
Legor17-Jul-11 0:39
Legor17-Jul-11 0:39 
GeneralRe: Pointer Maths Pin
enhzflep13-Jul-11 19:14
enhzflep13-Jul-11 19:14 
GeneralRe: Pointer Maths Pin
Richard MacCutchan13-Jul-11 21:53
mveRichard MacCutchan13-Jul-11 21:53 
QuestionHow to do 2 or more process simultaneously? Pin
Le@rner12-Jul-11 2:21
Le@rner12-Jul-11 2:21 
QuestionRe: How to do 2 or more process simultaneously? Pin
CPallini12-Jul-11 3:02
mveCPallini12-Jul-11 3:02 
AnswerRe: How to do 2 or more process simultaneously? Pin
Le@rner12-Jul-11 18:26
Le@rner12-Jul-11 18:26 
GeneralRe: How to do 2 or more process simultaneously? [fixed] Pin
CPallini12-Jul-11 21:09
mveCPallini12-Jul-11 21:09 
GeneralRe: How to do 2 or more process simultaneously? Pin
Le@rner12-Jul-11 21:16
Le@rner12-Jul-11 21:16 
GeneralRe: How to do 2 or more process simultaneously? Pin
CPallini12-Jul-11 21:24
mveCPallini12-Jul-11 21:24 

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.