The std::iterator_traits
class template defines 5 nested types: iterator_category
, value_type
, difference_type
, pointer
and reference
. Browsing the sources of the <algorithm>
header of both libc++ and libstdc++, one can see many uses of value_type
, difference_type
and iterator_category
, but only one for reference
(inside std::iter_swap
) and none for pointer
.
My application uses a hand-built proxy iterator / proxy reference pair. I want to transition to using the Boost iterator_facade
which lets me configure the reference type from the default T&
to an arbitrary type, but not so for the pointer type which is T*
by default. I want to avoid being bitten by some deeply hidden use of the nested pointer
type.
Note: the iterator is a proxy for a builtin type without nested members, so I do not need compatibility with operator->
(for which the return type would be pointer
).
Question: what use cases are there in the Standard Library for the nested type pointer
inside iterator_traits
?