7 Mar
2005
7 Mar
'05
12:31 a.m.
David Abrahams wrote:
"Peter Dimov"
writes: Uh, wait. iterator_traits was not well designed, I'll grant you, but all the same, I'd call using iterator_traits<X>::reference to mean "the return type of *x" a definite no-no. Just think about the consequences of all those other type names in iterator_traits.
Well, what else could it mean? :-)
Leaving aside the fact that in real life it is underspecified and used inconsistently, it could mean "the return type of *x where x is an iterator."
One interesting example is that Lambda used iterator_traits<X>::reference in exactly such a way, to infer the type of *x. I _almost_ put all the iterator_traits<> type names in shared_ptr just to make it work.