From: Sean P. <sp...@ad...> - 2005-12-13 00:57:25
|
A little more on the great forest cleanup... since nobody responded to my last note, depth is now moved to an adapter. Next item, I don't like the interface around edges: bool leading() const; void set_leading(bool); bool pivot(); My first thought was that there are really any invariants being protected here - and just expose leading as a data member: bool leading; That, however, doesn't work well with the adaptors - Second thought: bool leading() const; bool& leading(); This fails with the reverse iterator though were toggling leading _is_ more complicated than toggling a bool (which gets us back to a set_leading() interface). One option is to nuke the reverse fullorder iterator (Eric?) - you could still use a general reverse iterator adaptor, but you would lose the ability to toggle edges which in reverse is a questionable thing to do (it base iterator does a very odd flip around the pointed to node). Another thing I somewhat dislike is the use of a bool (maybe it should be called edge and return an enum?) - if (i.edge() == adobe::forest_leading_s)... I like the idea but dealing with enum types is just plain cumbersome... Another option that I'm somewhat fond of is to simply use leading_of and trailing_of as stand alone functions - then maybe have an is_leading and is_trailing for completeness- bool is_leading(iterator); bool is_trailing(iterator); iterator leading_of(iterator); iterator trailing_of(iterator); if (adobe::is_leading(i)) i = adobe::trialing_of(i); I can't find a case where it's very desirable to actually pivot - usually you want to just force to one side or another... This could also be combined with the previous - something like: is_edge<adobe::forest_leading_s>(i); i = edge<adobe::forest_trailing_s>(i); Anyone have suggestions? Sean |