[libcxx-commits] [PATCH] D123681: [libc++] Implement ranges::equal

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue May 24 04:00:58 PDT 2022


philnik added inline comments.


================
Comment at: libcxx/include/__algorithm/ranges_equal.h:93
+    if constexpr (sized_range<_Range1> && sized_range<_Range2>) {
+      if (ranges::size(__range1) != ranges::size(__range2))
+        return false;
----------------
var-const wrote:
> Mordante wrote:
> > Interesting that the standard uses `distance` instead of `size`.
> Same question -- what's the reason to use `size` as opposed to `distance` (which would be closer to the Standard)?
`ranges::distance` just forwards to `ranges::size` if it's a `sized_range`, so I don't see any reason for the additional indirection. If you'd rather have it spelled `ranges::distance` I can change it though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123681/new/

https://reviews.llvm.org/D123681



More information about the libcxx-commits mailing list