How can I get the pointer that an iterator points to and store it in a pointer variable?

I'm making a system like twitter for class called ShoutOut.com I want to be able to get the PublicShoutOut pointer pointed to by the start iterator and assign it to firstShoutOutToDisplay and secondShoutOutToDisplay because I need that in order to pass the pointers to one of my functions. When I step through the debugger the values in start are all default values like "" and so are the values in this->firstShoutOutToDisplay but the message that start points to is being output just fine.

EDIT: got rid of irrelevant code. Am I using the correct syntax to do this?

1
2
3
4
5
6
7
8
9
10
11
12
	if (start != finish)
	{
		//getting these because a shoutout needs to be passed to the function that displays
		//options for a shoutout
		this->firstShoutoutToDisplay = (*start);
		start++; //increment just to get the second shoutout to display
	}
	if (start != finish)
	{
		this->secondShoutOutToDisplay = (*start); //get the second shoutout to display
		start--; //bring start back to where it should start displaying shoutouts
	}
Last edited on
 
void PublicShoutOutDisplayingMenu::displayShoutOutsInFrame(Account* accountContainingTheList, string nameOfListToDisplay)


Really?
Using too much names can make the program hard to read...
I'll keep that in mind when coding the rest of it... Really the only code I need help with is this. firstShoutOutToDisplay is a pointer to a PublicShoutOut and I'm iterating through a list of PublicShoutOut* I want to be able to get the pointer the iterator start points to and put it in firstShoutOutToDisplay and do the same with secondShoutOutToDisplay

1
2
3
4
5
6
7
8
9
10
11
12
	if (start != finish)
	{
		//getting these because a shoutout needs to be passed to the function that displays
		//options for a shoutout
		this->firstShoutoutToDisplay = (*start);
		start++; //increment just to get the second shoutout to display
	}
	if (start != finish)
	{
		this->secondShoutOutToDisplay = (*start); //get the second shoutout to display
		start--; //bring start back to where it should start displaying shoutouts
	}
Topic archived. No new replies allowed.