Boost logo

Boost :

From: Stuart Dootson (stuart.dootson_at_[hidden])
Date: 2007-07-16 11:31:43

On 13/07/07, Stefan Seefeld <seefeld_at_[hidden]> wrote:
> Stuart Dootson wrote:
> > What was I doing - well, mainly iterating through nodes and evaluating
> > attribute values. For these functions, it would be nice to have some
> > form of filtering/transforming iterator layered on top of an elements
> > children_iterator that allows you to specify some subset of the
> > children that you want to see. I wrote a modified for_each that
> > performed an equivalent function (yes, I should have used Boosts
> > iterator adaptors). Also, it would be nice to have a typed attribute
> > value retrieval function. I knocked something up using lexical_cast
> > that did that - it'd be nice if it was in the library.
> Have you had a look at the 'traversal.cpp' example ? That may do what
> you want. (Some generalization of that may become part of the public API.)

Yes, I've had a look. I'd still rather have STL style iterators :-)

The other technique I've used, when iterating through elements where I
may encounter one of several different elements, was to use a
std::map, with element name as key and a boost::function as the value,
i.e. lookup the appropriate function and call the related function. I
initialise the map using Boost.Assign. It works quite nicely.

> Yes, I'd appreciate any patches, especially if they explain the proposed
> changes. I'm not sure what the best way to do that is, though. Can trac
> be configured to allow sandbox-project-specific issues ?
> Thanks,
> Stefan

I've attached patch (generated by Tortoise SVN) and 'patch
explanation' files. The diffs are a combination of a) what I needed to
do to get the dom.cpp file to compile under MSVC8, and b) some changes
I made to make things I wanted to do build. Hope they're of use.

Stuart Dootson

Boost list run by bdawes at, gregod at, cpdaniel at, john at