[libcxx-commits] [libcxx] [libc++] Forward more algorithms to the classic algorithms (PR #114674)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 4 08:28:46 PST 2024
================
@@ -25,14 +27,15 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Iter, class _Sent, class _BinaryPredicate>
+template <class _Iter, class _Sent, class _Pred, class _Proj>
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Iter
-__adjacent_find(_Iter __first, _Sent __last, _BinaryPredicate&& __pred) {
+__adjacent_find(_Iter __first, _Sent __last, _Pred& __pred, _Proj& __proj) {
----------------
ldionne wrote:
Do we really want to take the `pred` and `proj` by lvalue reference? Is that what we do in other internal `__algorithm` helpers?
I'd be tempted to take by rvalue-ref (so the caller is effectively forwarding/moving its arguments down and not touching them anymore), or by copy. Passing by lvalue ref seems to suggest that we expect mutation of these arguments, which is not the case IIUC.
https://github.com/llvm/llvm-project/pull/114674
More information about the libcxx-commits
mailing list