Movatterモバイル変換


[0]ホーム

URL:


Issue 1418 - WG21 CWG Issues
Title
Type of initializer_list backing array
Status
cd3
Section
9.5.5 [dcl.init.list]
Submitter
Johannes Schaub

Created on2011-11-19.00:00:00 last changed145 months ago

Messages

msg4149 (view)
Date: 2012-10-15.00:00:00

[Moved to DR at the October, 2012 meeting.]

msg3724 (view)
Date: 2012-02-15.00:00:00

Proposed resolution (February, 2012):

Change 9.5.5 [dcl.init.list] paragraph 5 as follows:

An object of typestd::initializer_list<E> isconstructed from an initializer list as if the implementationallocated an array ofN elements of typeconstE, whereN is the number of elements in the initializerlist. Each element of that array is copy-initialized with thecorresponding element of the initializer list, and thestd::initializer_list<E> object is constructed to referto that array. If a narrowing conversion is required to initializeany of the elements, the program is ill-formed. [Example:

  struct X {    X(std::initializer_list<double> v);  };  X x{ 1,2,3 };

The initialization will be implemented in a way roughly equivalentto this:

const double __a[3] = {double{1}, double{2}, double{3}};  X x(std::initializer_list<double>(__a, __a+3));

assuming that the implementation can construct an initializer_listobject with a pair of pointers. —end example]

msg3641 (view)
Date: 2011-11-19.00:00:00

According to 9.5.5 [dcl.init.list] paragraph 5, theelements of the backing array for an object of typestd::initializer_list<E> are of typeE. This is contradicted by the wording of17.11 [support.initlist] paragraph 2.

History
DateUserActionArgs
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-05-03 00:00:00adminsetstatus: dr -> drwp
2012-11-03 00:00:00adminsetmessages: +msg4149
2012-11-03 00:00:00adminsetstatus: ready -> dr
2012-02-27 00:00:00adminsetmessages: +msg3724
2012-02-27 00:00:00adminsetstatus: open -> ready
2011-11-19 00:00:00admincreate

[8]ページ先頭

©2009-2026 Movatter.jp