I'm brand new to iterator_adaptors, and this is probably way too trivial an example, but I have several classes in my project which aggregate other polymorphic objects in part-whole relationships. I'd like clients who call 'the_aggregate.begin()' to be able to call non-const methods on the aggregate's Parts, but I'd like to prevent direct replacement of the underlying container element 'Part*' itself. Likewise, I'd like clients who call 'the_aggregate.begin() const' to be prevented from doing anything with the aggregate's Parts other than calling it's const methods. Of course,
"Hickman, Greg"
STL container-supplied iterators aren't intended to work in this way.
If this situation is common enough, and iterator_adaptor can be used to quickly generate iterators with the desired behavior (I haven't completely tested it as of yet, but it seems to work), then perhaps this is just one example of a reasonable "Hello, world" introduction to iterator_adaptors.
I think the indirect iterator adaptor does what you want out-of-the-box. Unfortunately, I don't think its implemntation is any simpler than the transform iterator example which is already in the docs and which Beman had trouble with as a way of getting started. ----------------------------------------------------------- David Abrahams * Boost Consulting dave@boost-consulting.com * http://www.boost-consulting.com