Default std::vector<bool> default and move constructor

Jonathan Wakely jwakely@redhat.com
Wed May 31 10:34:00 GMT 2017


On 29/05/17 22:55 +0200, François Dumont wrote:
>Hi
>
>    It wasn't such a big deal to restore value-init of the allocator. 
>So here is the updated patch.
>
>    I used:
>      _Bvector_impl() _GLIBCXX_NOEXCEPT_IF( noexcept(_Bit_alloc_type()) )
>
>    rather than using is_nothrow_default_constructible. Any advantage 
>in one approach or the other ?

Well in general the is_nothrow_default_constructible trait also tells
you if the type is default-constructible at all, but the form above
won't compile if it isn't default-constructible. In this specific case
it doesn't matter, because that constructor won't compile anyway if
the allocator isn't default-constructible.



>    I'll complete testing and add a test on this value-initialization 
>before commit if you agree.

Thanks.

>    Tests still running but I'm pretty sure it will work the same.

Yes, it should do.

I'm going to commit a fix for PR80893 in vector<bool>::_M_initialize
but I don't think it will conflict with your changes.



More information about the Libstdc++ mailing list