Movatterモバイル変換


[0]ホーム

URL:



This page is a snapshot from the LWG issues list, see theLibrary Active Issues List for more information and the meaning ofC++17 status.

2699. Missing restriction in [numeric.requirements]

Section: 29.2[numeric.requirements]Status:C++17Submitter: Hubert TongOpened: 2016-05-03Last modified: 2017-07-30

Priority:3

View all otherissues in [numeric.requirements].

View all issues withC++17 status.

Discussion:

In N4582 subclause 29.2[numeric.requirements], the "considerable flexibility in how arrays are initialized" do not appear to allow for replacement of calls to the default constructor with calls to the copy constructor with an appropriate source value.

[2016-08-03 Chicago]

Fri AM: Moved to Tentatively Ready

Proposed resolution:

This wording is relative to N4582.

  1. Adjust 29.2[numeric.requirements]/1 as indicated:

    -1- Thecomplex andvalarray components are parameterized by the type of information they contain andmanipulate. […]

    1. (1.1) —T is not an abstract class (it has no pure virtual member functions);

    2. […]

    3. (1.8) — IfT is a class, its assignment operator, copy and default constructors, and destructor shall correspond to each other in the following sense:Initialization of raw storage using the copy constructor on the value ofT(), however obtained, is semantically equivalent to value initialization of the same raw storage. Initialization of raw storage using the default constructor, followed by assignment, is semantically equivalent to initialization of raw storage using the copy constructor. Destruction of an object, followed by initialization of its raw storage using the copy constructor, is semantically equivalent to assignment to the original object.[Note: This rule states, in part, that there shall not be any subtle differences in the semantics of initialization versus assignment. This gives an implementation considerable flexibility in how arrays are initialized.[Example: An implementation is allowed to initialize avalarray by allocating storage using thenew operator (which implies a call to the default constructor for each element) and then assigning eachelement its value. Or the implementation can allocate raw storage and use the copy constructor toinitialize each element. —end example]If the distinction between initialization and assignment is important for a class, or if it fails to satisfy anyof the other conditions listed above, the programmer should usevector (23.3.11) instead ofvalarrayfor that class; —end note]


[8]ページ先頭

©2009-2026 Movatter.jp