473,324 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

how can I access data with iterator?

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
2 1242
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Carlos Ribeiro | last post by:
Hello all, I'm posting this to the list with the intention to form a group of people interested in this type of solution. I'm not going to spam the list with it, unless for occasional and...
7
by: Wolfgang Jeltsch | last post by:
Hello, I want to write a list class with an iterator class as an inner class. The iterator class must have access to certain private members of the list class in order to do its job. Here is a...
3
by: Kyle Teague | last post by:
I have a list of pointers to structs as a private member of a class. If I call begin() in the same function as I added the data then no access violation occurs. However, if I try to call begin() in...
5
by: TheFerryman | last post by:
How bad is it to include a non const accessor to a container of objects? For instance template <class WheelType> class CarBase { typedef std::list<WheelType*> WheelList; private:
12
by: James Brown | last post by:
Hi all, Having problems designing a template-class. I'll describe my scenario first then show what I've come up with so far: Need a class to provide pointer/array-like access to an area of...
10
by: Chung Leong | last post by:
Just saw a message in pl.comp.lang.php, which states that the following message has appeared in the PHP CVS snapshot: Usage of {} to access string offsets is deprecated and will be removed in...
2
by: Piotr | last post by:
Can I create a Random Access Iterator which start at a certain index and end at a certain index of a container? I go thru this page, but I can't find an example....
5
by: Dilip | last post by:
Hi Folks I know the C++ standard doesn't talk about threads. However I am a little bit curious as to what might or might not happen with a particular scenario I encountered in my project. Its...
2
by: Steve555 | last post by:
Hi I have a class which makes much use of a Map: typedef map<char, string, less<char LSysRule; As you can see, text strings are stored with characters as the key. I'm trying to re-use...
23
by: tkpmep | last post by:
I have a list that starts with zeros, has sporadic data, and then has good data. I define the point at which the data turns good to be the first index with a non-zero entry that is followed by at...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.