[v3] Less noexcept

Marc Glisse marc.glisse@inria.fr
Mon Sep 23 20:44:00 GMT 2013


On Mon, 23 Sep 2013, Paolo Carlini wrote:

> Hi again,
>>> It is funny that with fully dynamic strings, the copy constructor is 
>>> "better" than the move constructor: faster, doesn't throw, etc. I think we 
>>> should remove the move constructor in that case, or at least make it act 
>>> the same as the copy constructor. I didn't mark the copy constructor as 
>>> noexcept, but without checking the code it seems likely we could.

I took a look at the code. First I got a headache because of the allocator 
stuff. And once the paracetamol started helping, I noticed that the 
is_leaked mechanism means it can throw anyway, so I was wrong.

>> We could, but in my opinion fiddling with those isn't worth the trouble, 
>> because the whole "fully dynamic string" thing is just a workaround for 
>> issues of the current reference counted implementation vs the statically 
>> allocated empty string on some targets.
> Well, I have a second (practical) thought about this part. If you are willing 
> to spend a little more time on this, and can confirm your preliminary 
> analysis about copy-constructor vs move-constructor, first blush it 
> definitely makes sense to me, I'm certainly not against your proposal of 
> having the move-constructor identical to the copy-constructor in that case. 
> In 4.9.x some targets, not Linux, would benefit from it.

Sorry.

-- 
Marc Glisse



More information about the Libstdc++ mailing list