On Sat, 2 Oct 2021 at 18:27, François Dumont wrote: > > I would like to propose this alternative approach. > > In this patch I make __normal_iterator and random iterator > _Safe_iterator compatible for pointer_traits primary template. > > Regarding pointer_traits I wonder if it shouldn't check for the > to_pointer method availability and use per default: return { > std::addressof(__e) }; otherwise. This way we wouldn't have to provide a > pointer_to method on __normal_iterator.
But I would rather not have these members present in vector::iterator and string::iterator, in case users accidentally start to rely on them being present. Another option would be to overload std::__to_address so it knows how to get the address from __normal_iterator and _Safe_iterator.