Subject: Re: [boost] [tree] tree cursors and iterators
From: Cromwell Enage (sponage_at_[hidden])
Date: 2011-05-10 23:50:21
--- On Tue, 5/10/11, Erik Erlandson wrote:
> It looks like this:
> cursor inorder_first();
> const_cursor inorder_cfirst() const;
> * Returns: A cursor to the binary_tree's first
> element in inorder (see [tr.order.iterators], §4).
> Perhaps it means "if you were going to traverse this tree
> in-order, here is the cursor that points to the first node
> you would visit in that traversal"
That sounds about right.
> I'm a little skeptical that such a thing is necessary.
> If I want in-order traversal, or breadth-first traversal,
> or any other particular kind of traversal, I'd use an
> appropriate iterator for that (which might very well be
> implemented on top of a cursor).
I agree that these methods aren't necessary, but they could make certain traversal initializations more efficient (pre-order comes to mind). The question becomes whether the efficiency is worth the update cost of inorder_first() et al.
Cromwell D. Enage
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk