GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libstdc++

libstdc++: Fix availability of flat_meow::operator=(initializer_list)

Fixes an issue where the assignment operator for `flat_map`, `flat_set` and their multi variants using initializer lists was not properly inherited.

The assignment operator for flat_map, flat_set, flat_multimap, and flat_multiset using initializer lists (e.g., x = { ... }) was not being correctly inherited from the private base class. This caused assignments to be less efficient, as they were treated as construction followed by move assignment. The commit brings in the assignment operator from _Flat_map_base and _Flat_set_base, and simplifies related tests.

In Details

The flat_map, flat_set, flat_multimap, and flat_multiset classes in libstdc++ were missing the operator=(initializer_list) from their private base classes (_Flat_map_base and _Flat_set_base). This caused an inefficient fallback to construction and move assignment. The fix explicitly brings in the assignment operator.

For Context

flat_map and flat_set are container classes in the C++ standard library that provide similar functionality to std::map and std::set, but with a different underlying data structure that can offer performance advantages in some cases. Initializer lists provide a convenient way to assign values to these containers. This commit corrects an issue where assigning values using initializer lists was not as efficient as it could be, improving performance.

Filed Under: libstdc++containersflat_mapflat_setinitializer_list