Wednesday, 15 February 2012

c++ - An element of a pointer vector of object pointers assignment -



c++ - An element of a pointer vector of object pointers assignment -

i'm having problem assigning element of pointer vector of object pointers object pointer. i'm on linux , using eclipse ide. if want take @ problem:

void parse::parsedatalogprogram(vector<token*>* tokens) { token* currenttoken = tokens[0]; ... }

i'm getting syntax error saying "cannot convert ‘std::vector’ ‘token*’ in initialization", although above doesn't seem way how prepare this?

tokens pointer, not vector itself. can do

tokens->operator[](0);

or

(*tokens)[0];

c++ object pointers vector variable-assignment

No comments:

Post a Comment