std::vector<bool> fix & enhancements
François Dumont
frs.dumont@gmail.com
Tue Oct 30 21:47:00 GMT 2018
Running tests in C++98 mode show that I had forgotten a 'return *this;'
in _Bvector_impl_data::operator=.
So here is the patch again.
On 10/30/18 7:28 AM, François Dumont wrote:
> Following Marc Glisse change to ignore _M_start offset I wanted to go
> a little step further and just remove it in _GLIBCXX_INLINE_VERSION mode.
>
> I also fix a regression we already fixed on mainstream std::vector
> regarding noexcept qualification of move constructor with allocator.
>
> And I implemented the same optimizations than in std::vector for
> allocators always comparing equals and for the std::swap operation.
>
> I also avoid re-implementing in vector::operator[] the same code
> already implemented in iterator::operator[] but this one should
> perhaps go in a different commit.
>
>
> Â Â Â * include/bits/stl_bvector.h
> Â Â Â [_GLIBCXX_INLINE_VERSION](_Bvector_impl_data::_M_start): Define as
> Â Â Â _Bit_type*.
> Â Â Â (_Bvector_impl_data(const _Bvector_impl_data&)): New.
> Â Â Â (_Bvector_impl_data(_Bvector_impl_data&&)): Delegate to latter.
> Â Â Â (_Bvector_impl_data::operator=(const _Bvector_impl_data&)): New.
> (_Bvector_impl_data::_M_move_data(_Bvector_impl_data&&)): Use latter.
> Â Â Â (_Bvector_impl_data::_M_reset()): Likewise.
> Â Â Â (_Bvector_impl_data::_M_begin()): New.
> Â Â Â (_Bvector_impl_data::_M_cbegin()): New.
> Â Â Â (_Bvector_impl_data::_M_start_p()): New.
> Â Â Â (_Bvector_impl_data::_M_set_start(_Bit_type*)): New.
> Â Â Â (_Bvector_impl_data::_M_swap_data): New.
> Â Â Â (_Bvector_impl::_Bvector_impl(_Bvector_impl&&)): Implement
> explicitely.
> Â Â Â (_Bvector_impl::_Bvector_impl(_Bit_alloc_type&&,
> _Bvector_impl&&)): New.
> Â Â Â (_Bvector_base::_Bvector_base(_Bvector_base&&, const
> allocator_type&)):
> Â Â Â New.
> Â Â Â (_Bvector_base::_M_deallocate()): Adapt.
> Â Â Â (vector::vector(const vector&, const allocator_type&)): Adapt.
> Â Â Â (vector::vector(vector&&, const allocator_type&, true_type)): New.
> Â Â Â (vector::vector(vector&&, const allocator_type&, false_type)): New.
> Â Â Â (vector::vector(vector&&, const allocator_type&)): Use latters.
> Â Â Â (vector::vector(const vector&, const allocator_type&)): Adapt.
> Â Â Â (vector::begin()): Adapt.
> Â Â Â (vector::cbegin()): Adapt.
> Â Â Â (vector::operator[](size_type)): Use iterator operator[].
> Â Â Â (vector::swap(vector&)): Adapt.
> Â Â Â (vector::flip()): Adapt.
> Â Â Â (vector::_M_initialize(size_type)): Adapt.
> Â Â Â (vector::_M_initialize_value(bool)): Adapt.
> Â Â Â * include/bits/vector.tcc:
> Â Â Â (vector<bool>::_M_reallocate(size_type)): Adapt.
> Â Â Â (vector<bool>::_M_fill_insert(iterator, size_type, bool)): Adapt.
> Â Â Â (vector<bool>::_M_insert_range<_FwdIter>(iterator, _FwdIter, _FwdIter
> Â Â Â std::forward_iterator_tag)): Adapt.
> Â Â Â (vector<bool>::_M_insert_aux(iterator, bool)): Adapt.
> Â Â Â (std::hash<std::vector<bool>>::operator()): Adapt.
> Â Â Â *
> testsuite/23_containers/vector/bool/cons/noexcept_move_construct.cc:
> Â Â Â Add check.
>
> Tested under Linux x86_64.
>
> Ok to commit ?
>
> François
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bvector.patch
Type: text/x-patch
Size: 12199 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20181030/c0c7133c/attachment.bin>
More information about the Libstdc++
mailing list