On Sat, 2 Oct 2021 at 14:08, François Dumont <frs.dum...@gmail.com> wrote:
>
> On 02/10/21 12:29 am, Jonathan Wakely wrote:
> > On Thu, 30 Sept 2021 at 21:27, François Dumont via Libstdc++
> > <libstd...@gcc.gnu.org> wrote:
> >> Here is the _Safe_iterator one.
> >>
> >> Doing so I noticed that pointer_traits rebind for __normal_iterator was
> >> wrong and added tests on it.
> > Oops, thanks!
> >
> >> For _Safe_iterator maybe I should specialize only when instantiated with
> >> __normal_iterator ? Or maybe limit to random_access_iterator_tag ?
> > Yes, I think that's a good idea, maybe only for __normal_iterator<T*,
> > C>. I think that should cover all the cases we actually need to
> > support.
> >
> > And could you change the existing pointer_traits<__normal_iterator<I,
> > C>> partial specialization to only be valid for
> > __normal_iterator<T*,C> as well? i.e. only for __normal_iterator that
> > wraps a pointer (which is true for string::iterator, vector::iterator
> > etc.)
>
> Is the attached patch what you had in mind ?

Yes, although I don't think we need to us __make_not_void for
to_pointer, because I don't think we would ever have
__normal_iterator<void*, C>. I don't think it will even compile,
because void* is not an iterator type, and iterator_traits<void*> is
invalid (in C++20 it's constrained with is_object_v<T> and before
C++20 it will just give an error, because void& is ill-formed).

Reply via email to