On 21-1-2016 21:09, Milian Wolff wrote:
On Donnerstag, 21. Januar 2016 07:25:21 CET André Somers wrote:
Op 21/01/2016 om 05:35 schreef Thiago Macieira:
On Thursday 21 January 2016 05:27:50 Kevin Kofler wrote:
Thiago Macieira wrote:
The copy constructor is called once, then the move constructor. If
value_type's move constructor is not noexcept, then it may throw after
the
container resized.
Throwing an exception in a move constructor is really, really horrible. I
can see why a copy constructor would throw (out of memory, failure to
duplicate some other resource), but a move?
Indeed.

But the class in question may not have a move constructor. In the absence
of one, the copy constructor gets called.
I generally don't care. If I can't copy anymore due to running out of
memory, I'm pretty much done anyway. No reliable way to recover from
that. Might as well terminate the program.
Right, _you_ don't care. But as a library one cannot usually make such claims.
People may want to use it in conditions where they _do_ care, and for good
reason. It would be a shame if C++ would not be applicable for such scenarios
just because some people didn't care enough.

So, please, enlighten me. What would be a realistic way to recover from such an exception?

André

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to