Re: [libxml++] node iterators



Jonathan Wakely wrote:

I'm now thinking that ForwardContainer migh be a better choice of STL
concept to model, as it has fewer requirements so might be simpler to
implement 1) while still supporting an STL-style interface. This would
mean you can get an iterator from any Node, not just from some container
type.

agreed. In fact, the more I think about suggestion 2) the more I like
it: the 'Node' class has a 'get_children()' and a 'get_attribute()'
method returning both a NodeList. So far it's almost as it was.
However, instead of typedefing NodeList to be 'std::list<Node *>',
I'd suggest we define it such that creation of a NodeList only implies
a single copy: that of the first child node / attribute of the given
node. The iterator is then implemented to traverse the libxml2 linked
list, not the STL container as it did before.

Does this sound satisfactory to everybody ?

Stefan





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]