|
Boost : |
From: Christian Engström (christian.engstrom_at_[hidden])
Date: 2004-02-27 15:52:43
>Yitzhak Sapir wrote:
>
> You could define a container adaptor that takes a container, and modifies the begin()/end() iterators to return indirect iterators to the original begin()/end(). Then instead of:
> typedef some_container container_type;
> you would have:
> typedef adaptor<some_container> container_type;
>
Yes, that was in fact what I was originally hoping for, but the best I
could manage for the general case was
proxy_container< some_container< proxy<T> > >
Still one line though, even if its an uglier line than I'd prefer. :-)
> You might want to read "Beware the Illusion of container-independent code", by Scott Meyers in his book: http://www.awprofessional.com/isapi/content/images/0201749629/items/item2-2.pdf
>
Good point, it's good to remember that the (partial) symmetry between
the STL containers manages to be useful despite some really quite major
restrictions and caveats, including some that may cause the program to
fail silently and intermittently --- *shudder*!
But even so, ...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk