[llvm] [ADT] Implement ArrayRef::operator< and other comparisons (PR #147277)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 7 11:52:30 PDT 2025


dwblaikie wrote:

> > Does std::span have these operators, and if it does, are they SFINAE-safe there? And if so, should they be made SFINAE-safe here too?
> 
> I think you might be mistaking me for a C++ expert :)
> 
> As far as I can tell from https://en.cppreference.com/w/cpp/container/span.html, std::span does not have these operators. But note that ArrayRef already had operator==, which std::span does not.

Hmm, yeah... bit of a pity that this is a direction that'll take us longer/make it harder to migrate to the standard thing... 

( https://brevzin.github.io/c++/2020/03/30/span-comparisons/ discusses some of the complexities of implementing these things in their full generality, including the SFINAE stuff (see the bit about REQUIRES))

Eh, for now - guess we'll give it a go, cross the bridge about SFINAE when we need it, and/or migrate to non-members/something else when we want to migrate to std::span one day.

https://github.com/llvm/llvm-project/pull/147277


More information about the llvm-commits mailing list