Class template std::iterator_traitsdefines the 5 sub-types: iterator_category, value_type, difference_type, pointerand reference. When viewing the header sources of <algorithm>both libC ++ and libstdC ++, you can see many uses value_type, difference_typeand iterator_category, but only one for reference(inside std::iter_swap) and none for pointer.
My application uses the reference proxy iterator reference of the proxy server. I want to move on to using Boost iterator_facade, which allows me to configure the link type from the default T&to an arbitrary type, but not so for the pointer type, which is T*the default. I want to avoid being bitten by some deeply hidden use of a nested type pointer.
Note : the iterator is a proxy for the built-in type without nested elements, so I do not need compatibility with operator->(for which the return type will be pointer).
Question : what use cases exist in the standard library for a nested type pointerinside iterator_traits?
source
share