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

François Dumont frs.dumont@gmail.com
Fri May 26 21:13:00 GMT 2017


On 25/05/2017 18:28, Jonathan Wakely wrote:
> On 15/05/17 19:57 +0200, François Dumont wrote:
>> Hi
>>
>>    Following what I have started on RbTree here is a patch to default 
>> implementation of default and move constructors on std::vector<bool>.
>>
>>    As in _Rb_tree_impl the default allocator is not value initialized 
>> anymore. We could add a small helper type arround the allocator to do 
>> this value initialization per default. Should I do so ?
>
> It's required to be value-initialized, so if your patch changes that
> then it's a problem.
>
> Did we decide it's OK to do that for RB-trees? Did we actually discuss
> that part of the r243379 changes?

I remember a message pointing this issue but after the commit AFAIR. I 
thought it was from Tim but I can't find it on the archive.

What is the rational of this requirement ? I started working on a type 
to do the allocator value initialization if there is no default 
constructor but it seems quite complicated to do so. It is quite sad 
that we can't fully benefit from this nice C++11 feature just because of 
this requirement. If there is any initialization needed it doesn't sound 
complicated to provide a default constructor.

>
>
> N.B. defining these members as defaulted makes diagnostics worse, see
> PR 80858, but I think we need to fix that in the compiler anyway.
>
>
Ok, I hope compiler will be able to improve this situtation.

François



More information about the Libstdc++ mailing list