From: Joao Abecasis (jpabecasis_at_[hidden])
Date: 2005-02-24 15:02:38
Thorsten Ottosen wrote:
> "Joao Abecasis" <jpabecasis_at_[hidden]> wrote in message
> | From the basic iterators other types of traversal are possible. In my
> |unfinished tree library (see my other post) the same effect would be
> |accomplished with:
> | inorder_iterator<tree_t::tree_iterator> i = tr.root();
> | preorder_iterator<tree_t::tree_iterator> i2 = tr.root();
> | This keeps the interface and the implementation of the tree cleaner. One
> | could also use BGL algorithms here if the tree exposes a Graph interface.
> you can still have your clean separation, but I would prefer to expose it
> as typedefs in the tree. That is going to be much more
> pleasent in generic code.
Ok. This seems to be a matter of taste, but I have to ask... Why is a
typedef more pleasant in generic code then a separate template?
You could have a single algorithm that takes different linearization
schemes like preorder and postorder as a template parameter and needn't
care what their names are.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk