So my typedef
is like:
typedef struct {
B b;
std::list<A>::iterator iter;
} A;
I know a self-referential pointer works, but not so sure about an iterator, although they are quite alike. Just want to make sure, thanks.
So my typedef
is like:
typedef struct {
B b;
std::list<A>::iterator iter;
} A;
I know a self-referential pointer works, but not so sure about an iterator, although they are quite alike. Just want to make sure, thanks.
Copyright © 2021 Jogjafile Inc.
is vestigial C syntax. The C++ way to write this is
As for storing an iterator, it's not really clear why you have any confusion about this.
However, using iterators requires caution. Many operations can invalidate existing operators, for example:
storing iterators is a sure-fire way to lead into a world of this kind of hurt.