<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/133065>133065</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[libc++] Use forwarding refs for predicates and projections in algorithms helpers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
libc++
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
imdj
</td>
</tr>
</table>
<pre>
Replace lvalue references with forwarding references for predicates and projections in algorithms helpers.
This point has been raised a couple of times in reviews:
- https://github.com/llvm/llvm-project/pull/114674#discussion_r1828013344
- https://github.com/llvm/llvm-project/pull/129565#discussion_r2006299321
Few helper functions already do this:
- https://github.com/llvm/llvm-project/blob/96925fa84c1e9cf4ffb68a7171a4b39d4677702a/libcxx/include/__algorithm/is_permutation.h#L73-L80
- https://github.com/llvm/llvm-project/blob/96925fa84c1e9cf4ffb68a7171a4b39d4677702a/libcxx/include/__algorithm/ranges_partition.h#L47
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMk8tu5CwQhZ8Gb1BaUIAvCy8SRV5l9eufdYtL2SaijQW4O3n7kZ3MJMpuMpuRkBCgOjpfFUfn7KcFsSfqgajHSm9ljqn3F_dcmehe-_9wDdoiDVcdNqQJR0y4WMz05stMx5huOjm_TJ-fxpjomtB5qwtmqhdH1xSf0RYfl0z9QnWYYvJlvmQ6Y1gx5RNh94Td_z_7TNfol0JnnalBXGjSPqOjmtq4rQFpHGnxFzyEEl493jIRe_EdnUtZjwMMBIbJl3kzJxsvBIYQrr-2u3c3BIZ1C4HAwLmsG0lAOJ_tlrOPyznxFlrGhZDy77ShU7X6og2M1dB1Avgb94C3907QcVveG6VDQu1eqYu0zP77kCZEQ2Do6g7UqFtpOXZ2lONo6lY3vOFaGtE5WTdNw0DvAt7YlxcCg19s2BwSGM7n30Pb7_N5xXTZit6tnmYC4qkRd08t-2csJr1MmM-rTsV_mJQNYfeV64XrRKcr7HkjoWulbOpq7kWjnGJCMeC6VaJjxgqGXJpRYTu2pvI9MFBMQM0ZcF6frOUGBJius1YhGiIZXrQPpx3wFNNU-Zw37LkQrFZV0AZDPuIGsCMQeDgW7PFL_dEWs02ZSBZ8LvlDp_gSjqB-KlOP9EfGLzH8XgCrLYX-j-d2wOX9l7_xXXv4GQAA___AlGgY">