[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 23 03:56:29 PST 2022


Mordante added a comment.

Since the current Standard seems to be broken I agree with implementing your proposed LWG-issue.
I prefer to wait with landing until you have a number so it can be used in the issue table and commit message.



================
Comment at: libcxx/docs/Status/Cxx2bIssues.csv:140
 "","","","",""
 `3645 <https://wg21.link/LWG3645>`__,"``resize_and_overwrite`` is overspecified to call its callback with lvalues", "Not voted in","|Complete|","14.0",""
-"","","","",""
----------------
Can you add your new issue here once you have a number?


================
Comment at: libcxx/include/__iterator/distance.h:63
+struct __fn {
+  template<input_or_output_iterator _Ip, sentinel_for<_Ip> _Sp>
+    requires (!sized_sentinel_for<_Sp, _Ip>)
----------------
`input_or_output_iterator` doesn't match the description. Should this be  `input_or_output_iterator` if just `class _Ip`?


================
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);
+
----------------
Please update this to match the implementation.


================
Comment at: libcxx/test/std/iterators/iterator.primitives/range.iter.ops/range.iter.ops.distance/iterator_sentinel.pass.cpp:81
+    assert(std::ranges::distance(a, a) == 0);
+    assert(std::ranges::distance(a+3, a) == -3);
+  }
----------------
Likewise two lines above.


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

https://reviews.llvm.org/D117940



More information about the libcxx-commits mailing list