-
- Downloads
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>
Showing
- libstdc++-v3/include/bits/ranges_algo.h 2 additions, 2 deletionslibstdc++-v3/include/bits/ranges_algo.h
- libstdc++-v3/include/bits/ranges_util.h 2 additions, 2 deletionslibstdc++-v3/include/bits/ranges_util.h
- libstdc++-v3/testsuite/25_algorithms/max/constrained.cc 25 additions, 0 deletionslibstdc++-v3/testsuite/25_algorithms/max/constrained.cc
- libstdc++-v3/testsuite/25_algorithms/min/constrained.cc 25 additions, 0 deletionslibstdc++-v3/testsuite/25_algorithms/min/constrained.cc
Loading
Please register or sign in to comment