[libcxx-commits] [PATCH] D117940: [libc++] [ranges] Implement std::ranges::distance

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jan 26 17:29:40 PST 2022


Quuxplusone added inline comments.


================
Comment at: libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.distance/iterator_sentinel.pass.cpp:17
+// template<input_or_output_iterator I, sized_sentinel_for<I> S>
+//   constexpr iter_difference_t<I> ranges::distance(const I& first, const S& last);
+
----------------
Mordante wrote:
> Please update this to match the implementation.
I guess it's still unclear what we should put here. What's here right now is the P/R for LWG3664, but we know the P/R is buggy — what I actually implemented uses `I&&` in place of `const I&`. I can fix that before landing, if we decide it needs fixing. No matter what, the person who fixes LWG3664 should re-audit this comment anyway.

Alternative ideas: use the P/R as written (i.e. what's here now); or, use the working draft's wording (i.e., remove the `decay_t` and replace `S` with `const S&`).


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

https://reviews.llvm.org/D117940



More information about the libcxx-commits mailing list