[libcxx-commits] [PATCH] D120637: [libc++][ranges] Implement ranges::minmax and ranges::minmax_element

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Apr 1 22:49:39 PDT 2022


var-const added inline comments.


================
Comment at: libcxx/include/__algorithm/ranges_minmax.h:75
+    } else {
+      // input_iterators can't be copied, so the implementation for input_iteratos has to store
+      // the values instead of a pointer to the correct values
----------------
Nit: `s/iteratos/iterators/`.


================
Comment at: libcxx/include/algorithm:118
+           indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less>
+    constexpr ranges::minmas_element_result<I>
+      minmax_element(I first, S last, Comp comp = {}, Proj proj = {});                    // since C++20
----------------
Nit: `s/minmas/minmax/`.


================
Comment at: libcxx/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax.pass.cpp:96
+    S a[3] = {S{2}, S{1}, S{3}};
+    std::same_as<std::ranges::minmax_result<const S&>> auto ret = std::ranges::minmax(a[0], a[1], {}, &S::i);
+    assert(&ret.min == &a[1]);
----------------
Nit: `decltype(auto)`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120637



More information about the libcxx-commits mailing list