[libcxx-commits] [PATCH] D121248: [libc++][ranges] Implement ranges::find{, _if, _if_not}

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 11 10:49:04 PST 2022


ldionne accepted this revision as: ldionne.
ldionne added a comment.

LGTM -- I stand by my comment of using `find_if_impl` instead of a helper function inside the struct. It's a minor difference but IMO it's important.

Leaving last approval to @var-const, who had requested changes.



================
Comment at: libcxx/include/__algorithm/ranges_find.h:48
+  borrowed_iterator_t<_Rp> operator()(_Rp&& __r, const _Tp& __value, _Proj __proj = {}) const {
+    auto __pred = [&](auto&& __e) { return std::forward<decltype(__e)>(__e) == __value; };
+    return ranges::__find_if_impl(ranges::begin(__r), ranges::end(__r), __pred, __proj);
----------------
If you want, you should also be able to write 

```
auto __pred = [&]<class _Ep>(_Ep&& __e) { return std::forward<_Ep>(__e) == __value; };
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121248



More information about the libcxx-commits mailing list