-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Le Lundi 26 Mai 2003 14:47, Murray Cumming Comneon com a écrit : > Sounds good. I will look at it some time to compare it to the gtkmm > STL-like stuff, which tries to implement as much of the STL-style interface > as possible in terms of just a few other methods, or overloads of the > methods. > I attached a patch with the current implementation if you want to have a closer look. It's not yet well tested but at least it compiles. > Maybe we also need > const Node::ChildrenList Node::get_children() const; It's done, I just forgot to mention it. > > I don't think we need > const Node::ConstChildrenList Node::get_children() const; > instead, but I could be wrong. no. > > > One problem I faced is the type return by iterator::operator*(). > > I first wanted to return a Node &. It is, I think, more > > logical, and avoid > > writing things like (*iter)->do_something(). > > However this change the use of dynamic_cast to 'test' the > > type of node. If the > > cast fail we have an exception instead of just returning a > > null pointer. > > That might not be too bad. People would tell us if they didn't like it. We > would probably want to catch them internally though. I agree. > > > Moreover this will make a bit heavy the switching from a > > version to another > > (but this may be acceptable from a 1.0 to 2.0 version upgrade). > > Yes, that kind of change is acceptable between major versions. Ok. > > One alternative I thought of is to have : > > Node * operator*() > > and > > Node * operator->() > > So we can both avoid complicating use of dynamic_cast and > > writing stuffs like > > (*iter)->do_something(). > > But I don't think this is a very standard behavior and would > > prefer not to do > > that. > > It sounds odd. > yes. I don't like it. Let's forget about it... Christophe -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+0hJ0B+sU3TyOQjARApqbAJ9AEBdCzZh8sYqNYs1SBVw0FOhKmgCg4D+Q VQudQefZR/2zjUIZzt5f5II= =O/Rl -----END PGP SIGNATURE-----
Attachment:
iterators.patch.gz
Description: GNU Zip compressed data