[Bug libstdc++/67922] [DR 2550] std::unordered_map::clear should take time linear in the number of elements

skywave2023 at outlook dot com gcc-bugzilla@gcc.gnu.org
Sat Jan 17 10:41:22 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67922

Castle "SkyWave" Sun <skywave2023 at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |skywave2023 at outlook dot com

--- Comment #6 from Castle "SkyWave" Sun <skywave2023 at outlook dot com> ---
Hi,

Thanks — I saw the last update from Jonathan Wakely on 2016-03-01 noting that
“LWG agrees with the proposed resolution of 2550”. It’s been almost 10 years
since then, and on current libstdc++ std::unordered_map::clear() still appears
to be linear in bucket_count() (e.g. after a large reserve()), not in size().

Could you please share the current status for aligning the implementation with
the LWG 2550 resolution (or clarify if libstdc++ considers the current behavior
conforming)? If there is a planned fix or any tracking issue/patch, a pointer
would be appreciated.

Thanks.


More information about the Gcc-bugs mailing list