[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-patches
Subject: Re: std::vector<bool> code cleanup fixes optimizations
From: Jonathan Wakely via Gcc-patches <gcc-patches () gcc ! gnu ! org>
Date: 2020-07-31 21:47:37
Message-ID: 20200731214737.GC3400 () redhat ! com
[Download RAW message or body]
On 31/07/20 23:03 +0200, François Dumont via Libstdc++ wrote:
>On 17/07/20 12:36 pm, Jonathan Wakely wrote:
>>On 16/12/19 08:18 +0100, François Dumont wrote:
>>>diff --git
>>>a/libstdc++-v3/testsuite/23_containers/vector/bool/allocator/swap.cc
>>>b/libstdc++-v3/testsuite/23_containers/vector/bool/allocator/swap.cc
>>>index de441426532..745fdc85cf6 100644
>>>--- a/libstdc++-v3/testsuite/23_containers/vector/bool/allocator/swap.cc
>>>+++ b/libstdc++-v3/testsuite/23_containers/vector/bool/allocator/swap.cc
>>>@@ -28,19 +28,17 @@ namespace __gnu_test
>>> // It is undefined behaviour to swap() containers with unequal
>>>allocators
>>> // if the allocator doesn't propagate, so ensure the allocators
>>>compare
>>> // equal, while still being able to test propagation via
>>>get_personality().
>>>+ template<typename Type>
>>> bool
>>>- operator==(const propagating_allocator<T, false>&,
>>>- const propagating_allocator<T, false>&)
>>>- {
>>>- return true;
>>>- }
>>>+ operator==(const propagating_allocator<Type, false>&,
>>>+ const propagating_allocator<Type, false>&)
>>>+ { return true; }
>>>
>>>+ template<typename Type>
>>> bool
>>>- operator!=(const propagating_allocator<T, false>&,
>>>- const propagating_allocator<T, false>&)
>>>- {
>>>- return false;
>>>- }
>>>+ operator!=(const propagating_allocator<Type, false>&,
>>>+ const propagating_allocator<Type, false>&)
>>>+ { return false; }
>>
>>Why does this test need to be adapted?
>>
>Because I replicate and adapt the static assertion from the main
>vector implementation which is:
>
>#if __cplusplus >= 201103L
>__glibcxx_assert(_Bit_alloc_traits::propagate_on_container_swap::value
> || _M_get_Bit_allocator() == __x._M_get_Bit_allocator());
>#endif
>
>in the case of vector<bool> the compared allocators are not
>propagating_allocator<bool, false> but propagating_allocator<unsigned
>long, false>.
Ah yes, of course. Thanks.
>Building with __glibcxx_assert was showing this.
>
>François
>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic