
For the sake of hacking together proxies that work with algorithms which expect STL containers, providing the nested typedefs may be the only option to optimize code reuse, but in those cases, you have to realize that what you would be doing truely is a hack, since a proxy itself is not a valid STL container type and therefore shouldn't be passed to algorithms where one is expected.
I tend to disagree. I think of an proxy object not so much as a "reference" but rather as a "drop-in replacement" that happens by chance to be connected to some other container object, but that is only an implementation detail. If the proxy models an STL container then it should work with any STL or other appropriate algorithm and I do not consider this a hack. It simply works as designed. Therefore I favor option 1). Clearly a non-const proxy may not be constructed from a const container. When I pass some container-alike object into some method e.g. as const reference, I do not expect its contents to be modifyable. For some more thoughts about const and non-const iterators, see also http://www.boost.org/libs/iterator/doc/iterator_facade.html#a-constant-n ode-iterator Yours, -- Dr. Martin Schulz (schulz@synopsys.com) Software Engineer Synopsys GmbH Karl-Hammerschmidt-Str. 34 D-85609 Dornach, Germany Phone: +49 (89) 993-20203 http://www.synopsys.com