dimanche 24 avril 2016

How can I make an iterator over fields of container's items?

So, say, I have a std::list<std::pair<int, std::string>>; how can I make an iterator such that it iterates over strings contained in this list?

Or, for example, I have a struct with fields a, b and c; can I create an iterator, which, when dereferenced, will return a std::pair, corresponding to (b, c)?

Aucun commentaire:

Enregistrer un commentaire