https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102015
Bug ID: 102015
Summary: [missed optimization] Small memory overhead in
_Rb_tree_impl (fix would require ABI break)
Product: gcc
Version: 11.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: kamkaz at windowslive dot com
Target Milestone: ---
Current definition of _Rb_tree_key_compare causes size overhead for all
std::(multi)set/map-s:
template<typename _Key_compare>
struct _Rb_tree_key_compare
{
_Key_compare _M_key_compare;
...
};
If it were possible to change the ABI in the future, I think it can be improved
by empty-base-optimization for comparators that are not final classes - or by
adding [[no_unique_address]] to _M_key_compare.