Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Problem programmer?

Name: Anonymous 2011-04-20 14:49

in main:

vector<int> player_nr;
int x = menu(player_nr.begin());

menu function:

int menu(vector<int>::iterator x)
{
...
int a = x->size(); //<---- complains here
...
}

As far as I understood it Vectors have the arrow-operator defined in C++. Then why the fuck does the compilator complain of it?

Name: Anonymous 2011-04-20 16:20

>>6
There is a small mistake here, you are dereferencing the iterator with the single arrow, (->), which will just get you the current object, i.e. in this case an int, which does not have a size method.
To access the originating vector, you should use the double arrow, (==>). Note the shaft length of two; if you only use one you'll access properties of the player object after casting it to a BigInteger, and if you use three you can call methods on the main function.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List