This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 117b. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-08-11
1232. Creation of array temporaries using a braced-init-listSection: 9.5.5 [dcl.init.list] Status: C++11 Submitter: Andrew Koenig Date: 2011-01-03[Voted into the WP at the March, 2011 meeting as part of paper N3262.]
By analogy with the variable definition
int arr[3] = {1, 2, 3};
it should be possible to write something like
void f(const int(&)[3]); void g() { f({1, 2, 3}); }
There are currently at least two problems with the latter usage. First, the variable initializer relies on brace elision, which appears to be defined only for variable declarations (9.5.2 [dcl.init.aggr] paragraph 11) , and possibly only for certain forms of variable declarations.
Second, the call would require creation of an array temporary to which the parameter reference would be bound, and the current Standard does not describe array temporaries (although rvalue arrays can occur as members of class rvalues). This is also contrary to the direction established by CWG in considering 1058.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4