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

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 16:39:10 PDT 2018


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?


Repository:
  rL LLVM

https://reviews.llvm.org/D53909





More information about the llvm-commits mailing list