Jump to content

Vector Iterator -> operand error


AggrorJorn
 Share

Recommended Posts

I want to make a simple iteration through a vector, yet I get the error that operator is not matching the operands.

//.h
vector<resolution*> resolutionList;


//.CPP
resolutionList.push_back(new resolution(640,480,resolution.Ratio._4_3_));

vector<resolution>::iterator i;
for(i = resolutionList.begin(); i != resolutionList.end(); ++i)
{


What am I doing wrong here?

Link to comment
Share on other sites

Just to avoid those mistakes ( happens even so often ) I usually add a typedef like this

 

 

//.h

typedef vector<resolution*> ResolutionList;

ResolutionList resolutionList;

 

 

//.CPP

resolutionList.push_back(new resolution(640,480,resolution.Ratio._4_3_));

 

ResolutionList::iterator i;

for(i = resolutionList.begin(); i != resolutionList.end(); ++i)

{

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...