stl_map.h control flow to stl_tree.h question

Jonathan Wakely jwakely.gcc@gmail.com
Mon Nov 10 07:14:48 GMT 2025


N.B. this is not "control flow".

On Mon, 10 Nov 2025, 04:36 Anton Kalinin, <antonkalinin55@gmail.com> wrote:

> Why does the map implementation need to call pair_alloc_type on the passed
> in map allocator prior to calling the rb_tree constructors.
>

Because historically we didn't enforce the rule that the map's allocator
had to be the current type:

https://github.com/gcc-mirror/gcc/blob/d538348556bd05fba13e41cb8497bda2eb086e63/libstdc%2B%2B-v3/include/bits/stl_map.h#L128

I.e. we allowed std::map<int, int, less<int>, allocator<int>>.


>
> https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/stl_map.h#L211
>
> https://github.com/gcc-mirror/gcc/blob/master/libstdc%2B%2B-v3/include/bits/stl_map.h#L246
> etc
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20251110/afc5ea82/attachment.htm>


More information about the Libstdc++ mailing list