|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-02-26 10:45:01
Hi Craig,
There's an iterator similar to this in the graph library, the
edge_iterator for the directed adjacency_list. See
boost/graph/detail/adj_list_edge_iterator.hpp. It's specialized a bit for
the BGL graph interface, but it may not be too hard to adapt to your
purposes.
One small word of caution... this iterator is not as fast as using two
explicit loops.
Cheers,
Jeremy
On Mon, 26 Feb 2001, Craig Henderson wrote:
craigh> I am looking for a solution to the problem of iterating
craigh> through a list of a list using STL iterator technique, and
craigh> wonder if boost provides any such functionality.
craigh>
craigh> for example, I have definitions such as
craigh> class Element;
craigh> typedef ElementList_t std::list<Element const *>;
craigh> typedef GroupList_t std::list<ElementList const *>;
craigh>
craigh> and given a GroupList I need to iterator all the elements in a manner along
craigh> the lines of
craigh>
craigh> GroupList_t group;
craigh> ElementList_t::const_iterator iter;
craigh> for (iter = group.first_element(); iter!=group.last_element(); iter++)
craigh> {
craigh> Element const *pElement = *iter;
craigh> ...
craigh> }
craigh>
craigh> Now, obviously the iterator is going to have to be
craigh> intelligent enough to iterate each ElementList in turn and
craigh> move onto the next when appropriate.
craigh>
craigh> Before I begin development of such an iterator I thought
craigh> it worth asking the question of my peers ;)
craigh>
craigh> TIA
craigh> Craig Henderson (new to boost)
craigh>
craigh>
craigh>
craigh>
craigh>
craigh> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
craigh>
craigh>
craigh>
----------------------------------------------------------------------
Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
Ph.D. Candidate email: jsiek_at_[hidden]
Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk