[PATCH] D53909: ADT/STLExtras: Introduce llvm::empty(); NFC

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 16:53:06 PDT 2018


On Tue, Oct 30, 2018 at 4:39 PM Matthias Braun via Phabricator <
reviews at reviews.llvm.org> wrote:

> MatzeB added a comment.
>
> In https://reviews.llvm.org/D53909#1281525, @dblaikie wrote:
>
> > (maybe some unit tests?)
> >
> > Also, what about having only a single implementation:
> >
> >   template <typename Range>
> >   constexpr bool empty(const Range &r) {
> >     return adl_begin(r) == adl_end(r);
> >   }
> >
> >
> > Not sure why the standard library doesn't do it this way, but there are
> probably good reasons... though maybe they don't apply to us/llvm?
>
>
> What if the container has an optimized empty() method that works faster
> than actually producing begin and end iterators?
>

Good point... & yeah, worth doing something the same way as the standard.


>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D53909
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181030/3af10ac4/attachment.html>


More information about the llvm-commits mailing list