diff options
author | Patrick Palka <ppalka@redhat.com> | 2025-06-13 11:03:19 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2025-06-13 11:03:19 -0400 |
commit | 5e8168a659ecc63804984d20365b4df401d9675b (patch) | |
tree | f23bac5813785b3d1d172fa5a1cbbf58971ac6de /libstdc++-v3/testsuite/std | |
parent | f6f4efdf397269793167fb1303967e7ad0e467a7 (diff) | |
download | gcc-5e8168a659ecc63804984d20365b4df401d9675b.zip gcc-5e8168a659ecc63804984d20365b4df401d9675b.tar.gz gcc-5e8168a659ecc63804984d20365b4df401d9675b.tar.bz2 |
libstdc++: Optimize __make_comp/pred_proj for empty/scalar types
When creating a composite comparator/predicate that invokes a given
projection function, we don't need to capture a scalar (such as a
function pointer or member pointer) or empty object by reference,
instead capture it by value and use [[no_unique_address]] to elide
its storage (in the empty case). This makes using __make_comp_proj
zero-cost in the common case where both functions are empty/scalars.
libstdc++-v3/ChangeLog:
* include/bits/ranges_algo.h (__detail::__by_ref_or_value_fn): New.
(__detail::_Comp_proj): New.
(__detail::__make_comp_proj): Use it instead.
(__detail::_Pred_proj): New.
(__detail::__make_pred_proj): Use it instead.
Reviewed-by: Tomasz KamiĆski <tkaminsk@redhat.com>
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Diffstat (limited to 'libstdc++-v3/testsuite/std')
0 files changed, 0 insertions, 0 deletions