C++ Logo


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 22:07:09 +0200
On 27/07/2021 21:59, Brian Bi via Std-Discussion wrote:
> Copy and move constructors always create new objects, whereas the swap
> function doesn't. This allows swap to be noexcept in more cases. An
> example is libstdc++'s std::deque implementation (assuming standard
> allocator).

My bad, by "throwing Xable" I assumed both X construction and X
assignment were throwing, and thus extended that to swaps.

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 15:07:14