C++ Logo

std-discussion

Advanced search

Re: Vector implementation of behavior when inserting objects whose copy constructor can throw

From: Giuseppe D'Angelo <giuseppe.dangelo_at_[hidden]>
Date: Tue, 27 Jul 2021 21:47:29 +0200
Hi,

On 25/07/2021 20:45, Jason McKesson via Std-Discussion wrote:
> The
> standard makes it clear that if `T` is not CopyInsertable, and `T`'s
> move constructor throws, then the state of the `vector` is
> unspecified. But otherwise, the `vector<T>`'s state in the event of an
> exception is unchanged.

The Standard puts a lot of requirements for this to happen; do you have
a reference to the relevant parts?

If you asked me randomly, I would've said that for a type 2 (throwing
copiable, throwing movable) the only guarantee (if any) could've been
the basic one, not the strong one...

Thanks,
-- 
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

Received on 2021-07-27 14:47:37