Re: [PATCH] libstdc++: Fix flat_map::operator[] for const lvalue keys [PR120432]

2025-05-28 Thread Tomasz Kaminski
; > Given that the operator[] that we are forading to is implemented as: > > { return try_emplace(std::forward<_Key2>(__x)).first->second; } > > I would just call try_emplace directly: > > Good point, the implementation is a simple one-liner either way, and it >

Re: [PATCH] libstdc++: Fix flat_map::operator[] for const lvalue keys [PR120432]

2025-05-28 Thread Patrick Palka
iven that the operator[] that we are forading to is implemented as: >         { return try_emplace(std::forward<_Key2>(__x)).first->second; } > I would just call try_emplace directly: Good point, the implementation is a simple one-liner either way, and it addresses the volatile k

Re: [PATCH] libstdc++: Fix flat_map::operator[] for const lvalue keys [PR120432]

2025-05-27 Thread Tomasz Kaminski
On Tue, May 27, 2025 at 7:08 PM Patrick Palka wrote: > Tested on x86_64-pc-linux-gnu, does this look OK for trunk/15? > > The 'volatile' issue from that PR Will be fixed in a separate patch as > operator[] isn't the only operation that's affected. > > -- >8 -- > > The const lvalue operator[] over

[PATCH] libstdc++: Fix flat_map::operator[] for const lvalue keys [PR120432]

2025-05-27 Thread Patrick Palka
Tested on x86_64-pc-linux-gnu, does this look OK for trunk/15? The 'volatile' issue from that PR Will be fixed in a separate patch as operator[] isn't the only operation that's affected. -- >8 -- The const lvalue operator[] overload wasn't properly forwarding the key type to the generic overload