By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,389 Members | 1,881 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,389 IT Pros & Developers. It's quick & easy.

how can I access data with iterator?

P: n/a
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!
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"JosephWu" <wu*******@hotmail.com> wrote in message
news:Xn***********************@202.180.64.19...
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 = ...;

--
David Hilsee
Jul 22 '05 #2

P: n/a
David Hilsee wrote:
"JosephWu" <wu*******@hotmail.com> wrote in message
news:Xn***********************@202.180.64.19...
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 = ...;

thank you
Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.