diff options
author | Patrick Palka <ppalka@redhat.com> | 2024-12-13 13:17:29 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2024-12-13 13:17:29 -0500 |
commit | b8314ebff2495ee22f9e2203093bdada9843a0f5 (patch) | |
tree | 79cf37a1df2d3352c97ffb172a34c1aaac68ad0e /gcc | |
parent | 2089009210a1774c37e527ead8bbcaaa1a7a9d2d (diff) | |
download | gcc-b8314ebff2495ee22f9e2203093bdada9843a0f5.zip gcc-b8314ebff2495ee22f9e2203093bdada9843a0f5.tar.gz gcc-b8314ebff2495ee22f9e2203093bdada9843a0f5.tar.bz2 |
libstdc++: Avoid unnecessary copies in ranges::min/max [PR112349]
Use a local reference for the (now possibly lifetime extended) result of
*__first so that we copy it only when necessary.
PR libstdc++/112349
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (__min_fn::operator()): Turn local
object __tmp into a reference.
* include/bits/ranges_util.h (__max_fn::operator()): Likewise.
* testsuite/25_algorithms/max/constrained.cc (test04): New test.
* testsuite/25_algorithms/min/constrained.cc (test04): New test.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions