[PATCH] D33919: [ADT] Ensure that correct overrides for SmallVector assign are selected

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 13:09:23 PDT 2017


I'd suggest taking some inspiration from libc++ that has an implementation
of the relevant traits that implements the standards-required SFINAE here.

On Tue, Jun 6, 2017 at 12:59 PM Francis Ricci <francisjricci at gmail.com>
wrote:

> The primary issue I ran into there was that there are many possible
> valid input types, and checking for the full set gets pretty messy
> (const iterator vs iterator vs pointer, etc). One possible way that
> wasn't too messy was to check whether the type was dereferenceable and
> iterable (ie can you run *val and ++val), which works as well but
> seems hacky to me.
>
> This solution seemed like the cleanest one, but I can try to work
> something out in terms of checking for all the possible valid
> iterator/pointer types.
>
> On Tue, Jun 6, 2017 at 3:54 PM, David Blaikie <dblaikie at gmail.com> wrote:
> > I feel like this should probably be implemented the same way as the
> standard
> > requires - if the type is not a forward iterator, rather than
> non-integral.
> > (you could imagine/create a test case for a situation where there's a
> type
> > that's implicitly convertible to an integral type (for use as the offset
> > point in an append call) & either the value type or convertible to it -
> but
> > not an integral type)
> >
> > & also this should be tested and similar solution probably applied to the
> > "assign(iter, iter)" and the (iter, iter) ctor.
> >
> > On Tue, Jun 6, 2017 at 11:37 AM Francis Ricci via Phabricator
> > <reviews at reviews.llvm.org> wrote:
> >>
> >> fjricci added a subscriber: efriedma.
> >> fjricci added a comment.
> >>
> >> Accidentally removed a subscriber, re-adding
> >>
> >>
> >> https://reviews.llvm.org/D33919
> >>
> >>
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170606/6a5082a3/attachment.html>


More information about the llvm-commits mailing list