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

iterators, pointers, classes, pointers

Name: OP 2010-11-08 4:10

in c++.
i have a list of pointers to a class called Intersection:
list <Intersection *> all;

Within my Intersection class, there is a public member variable that is a list of road segments:
list <class Road_Segment *> adj;

i dont want to bog yall down with the nitty gritty details of my assignment, but what I need to do is:
iterate through 'all' and reassign new 'adj' values to each Intersection that 'all' points to.

IN A NUTSHELL: i dont know what syntax to use when using a list iterator to iterate through a list of pointers, and change the values of the member variables of the class that the pointers point to...

Thats about as simply as i think i can put it.

by using *lit im accessing the pointers to the intersection class... and I want to think that dereferencing those pointers would give me access to the intersection classes' member variables. which i could then modify using arrow/dot notation to specify which particuliar one.

Name: VIPPER 2010-11-08 4:54

I wish i was a real programmer, or a drug dealer. ;_;

Name: Anonymous 2010-11-08 5:02

less of this

Name: Anonymous 2010-11-08 5:08

modify using arrow/dot notation
I... um...
Man Sepples classes are more fucked up than the Java ones.
I supposedly know everything about objects, encapsulation and aliasing but have yet to be told about loops.

Name: Anonymous 2010-11-08 5:23

Jackson 5 GET

Name: Anonymous 2010-11-08 5:39

>IN A NUTSHELL: i dont know what syntax to use when using a list iterator to iterate through a list of pointers,


for(std::list<Your_Shitty_Class*>::iterator it = list.begin(); it != list.end(); ++it){
Your_ShittyClass* wareNoNeko= *it;
wareNoNeko->adj = kirei;
}

Name: Anonymous 2010-11-08 9:46

>>6
Why would you use such silly casing

Name: Anonymous 2010-11-08 11:25

>>7
To not scare OP with his Road_Segment :3

Name: Anonymous 2010-11-26 19:42

Name: Anonymous 2011-01-31 20:09

<-- check em dubz

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