[libcxx-commits] [libcxx] [libc++] Make lazy three way comparator optimization apply in older standard modes (PR #218525)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Aug 26 22:25:06 PDT 2026
================
@@ -713,16 +714,16 @@ template <class _MapValueT, class _Key, class _TransparentKey, class _Compare>
struct __lazy_synth_three_way_comparator<__map_value_compare<_Key, _MapValueT, _Compare>, _MapValueT, _TransparentKey> {
__lazy_synth_three_way_comparator<_Compare, _Key, _TransparentKey> __comp_;
- __lazy_synth_three_way_comparator(
+ _LIBCPP_CONSTEXPR_SINCE_CXX26 __lazy_synth_three_way_comparator(
_LIBCPP_CTOR_LIFETIMEBOUND const __map_value_compare<_Key, _MapValueT, _Compare>& __comp)
: __comp_(__comp.key_comp()) {}
- _LIBCPP_HIDE_FROM_ABI auto
- operator()(_LIBCPP_LIFETIMEBOUND const _MapValueT& __lhs, _LIBCPP_LIFETIMEBOUND const _TransparentKey& __rhs) const {
+ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX26 auto
+ operator()(_LIBCPP_LIFETIMEBOUND const _MapValueT& __lhs, _LIBCPP_LIFETIMEBOUND const _TransparentKey& __rhs) const
+ -> decltype(__comp_(__lhs.first, __rhs)) {
----------------
frederick-vs-ja wrote:
> I don't recommend making this change. `_LIBCPP_HIDE_FROM_ABI` is an ABI hiding macro simply to hide ABI symbols and prevent dynamic library conflicts.
The original issue is unrelated to dynamic libraries. For inline and "hidden from ABI" functions, there're possibly multiple definitions in multiple compiled translation units, and the program would be ill-behaved if there definitions don't agree.
https://github.com/llvm/llvm-project/pull/218525
More information about the libcxx-commits
mailing list