A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.
Document number: N4055
Date: 2014-07-02
Ruminations on (node-based) containers and noexcept
by Ville Voutilainen
Excerpt:
There are quite many standard containers that do not have noexcept move constructors required by their synopsis. Implementations can strengthen such a noexcept-specification as per [res.on.exception.handling]/1: "Any of the functions defined in the C ++ standard library can report a failure by throwing an exception of a type described in its Throws: paragraph. An implementation may strengthen the exception-specification for a non-virtual function by adding a non-throwing noexcept-specification."
The issue is that this means that the performance of operations such as vector<T>::push_back becomes dependent on the noexcept-specification of the move constructor of T, and if T has a container member, the noexcept-specification of that container influences the noexcept-specification of the move constructor of T in implementation-specific ways.
This paper explores the reasons of why container move constructors are not noexcept on some implementations. A very good explanation is written below.
This paper also makes some moderate suggestions on what the solution(s) should be.
Nicolai Josuttis proposes some of those moderate suggestions in his paper N4002.
Add a Comment
Comments are closed.