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

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jan 30 05:51:02 PST 2022


Mordante 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);
+
----------------
Quuxplusone wrote:
> 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&`).
I think it would be better to use `I&&` since that's what you've implemented. Maybe add a comment this wording needs updating for LWG3664.


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

https://reviews.llvm.org/D117940



More information about the libcxx-commits mailing list