C++11 §23.2.1.10 specifies:
Unless otherwise specified all container types defined in this Clause meet the following additional requirements:
- if an exception is thrown by an insert() or emplace() function while inserting a single element, that function has no effects.
- no erase() , clear() , pop_back() or pop_front() function throws an exception.
Regarding the first bullet point, How do the container guarantee that? The constructor for T might have side-effects. Should it not be "has no effect on the container"
Regarding the second bullet point, This normally calls allocator::deallocate(T*,size_t) which is not noexcept. Why should eventual exceptions be masked away?
Aucun commentaire:
Enregistrer un commentaire