how can I access data with iterator?

J

JosephWu

I have a vector which stores some pointers .thoes pointers point to some
objects which those object has variables and functions .

the problem is ,how can I get the variales/functions?

(**&*iterator).variable ?


Thanks a lot!
 
D

David Hilsee

JosephWu said:
I have a vector which stores some pointers .thoes pointers point to some
objects which those object has variables and functions .

the problem is ,how can I get the variales/functions?

(**&*iterator).variable ?

Assuming you mean something like

std::vector<classname *> vec;
// ...
std::iterator it = vec.begin();

where classname has a member named member_of_classname, you can do something
like

(*it)->member_of_classname = ...;

or

(**it).member_of_classname = ...;
 
J

Joseph Wu

David said:
Assuming you mean something like

std::vector<classname *> vec;
// ...
std::iterator it = vec.begin();

where classname has a member named member_of_classname, you can do something
like

(*it)->member_of_classname = ...;

or

(**it).member_of_classname = ...;
thank you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,175
Messages
2,570,942
Members
47,489
Latest member
BrigidaD91

Latest Threads

Top