[PATCH] Avoid allocator operator== in _Safe_container

François Dumont frs.dumont@gmail.com
Mon Aug 9 12:08:11 GMT 2021


On 09/08/21 1:52 pm, François Dumont wrote:
> On 09/08/21 12:45 pm, Jonathan Wakely wrote:
>> On Mon, 9 Aug 2021 at 11:34, Jonathan Wakely wrote:
>>> On Mon, 9 Aug 2021 at 11:33, Jonathan Wakely wrote:
>>>> On Mon, 9 Aug 2021 at 11:26, François Dumont via Libstdc++
>>>> <libstdc++@gcc.gnu.org> wrote:
>>>>> Some newly introduced tests in
>>>>> 23_containers/unordered_map/cons/default.cc revealed that we are 
>>>>> forcing
>>>>> the allocator type to have a operator==.
>>>> All allocators are required to have operator== so that should not be a
>>>> problem. What is the error?
>>> OK, I see it. I just forgot to define operator== and operator!= for
>>> the custom allocator in that new test, and that should be added.
>> Fixed like this instead. Tested x86_64-linux with -D_GLIBCXX_DEBUG.
>> Pushed to trunk.
>
> Ok, I thought my change was better because we have many allocator 
> types in tests without operator ==/!= (see 
> 23_containers/*/cons/noexcept_default_construct.cc). But of course the 
> tests are not making any use of it for the moment, no big deal.
>
> So this patch is just an optimization, may I still commit it ? Unless 
> you like the fact that Debug mode is checking that those operators are 
> provided when allocator-aware move constructor is being used.
>
>
A simpler version, using _Safe_container move constructor when allocator 
instances are always equals.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: safe_container.patch
Type: text/x-patch
Size: 1084 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20210809/864b556e/attachment.bin>


More information about the Libstdc++ mailing list