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: N4043
Date: 2014-05-22
Dynarray Allocation Context
by Lawrence Crowl
Excerpt:
Introduction
The
dynarray
class (N3662 C++ Dynamic Arrays and N3820 Working Draft, Technical Specification — Array Extensions) and any other named class attempting to use the execution stack for allocation may suffer failure if the class is reallocated with in-place destruction and a placement new. This problem is described in N3899 Nested Allocation section Nested Lifetime. We need specific wording to address this case.Solution
We choose to permit the stack optimization for constructors called an automatic variables and then only if not called with the placement new operator. This change effectively requires the compiler to recognize the context of a constructor call and, when appropriate, change the implementation to an alternate implementation.
Add a Comment
Comments are closed.