This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

STL - How to use of iterators?


Hello!
    I have readed some docs and tried some things with my compiler but I
don't get to understand the use of iterators very well. Suppose I have a
class A.

class A
{
    public:
        ...
        int number;
}

    Then I create a list with some instances.

main (int argc, char *argv []) {
    list<A> l;
    A a;
    l.push_back (a);
    l.push_back (a);
    l.push_back (a);
    ...

    Could somebody give me examples of accesing (reading and writing)
the member "number" of the elements of "l" sequently and randomly?.
Thanks in advance.

--
Ivan Martinez (Rodriguez)
Bch in Computer Science - MSc student
http://www.student.dtu.dk/~u990873
"Ponia Windows98 o superior, asi que instale Linux"




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]