Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++.moderated > #1434
| From | Helmut Jarausch <jarausch@igpm.rwth-aachen.de> |
|---|---|
| Newsgroups | comp.lang.c++.moderated |
| Subject | Re: See if this usage about initializer_list is conforming to the final draft |
| Date | 2011-06-09 15:54 -0600 |
| Organization | unknown |
| Message-ID | <95bvfhF7jsU1@mid.dfncis.de> (permalink) |
| References | <3310b0a0-d3ac-497c-b177-ef05f83cdadd@l14g2000pro.googlegroups.com> |
On Thu, 09 Jun 2011 07:02:48 -0600, hayate wrote:
> code:
> http://ideone.com/T6GFO
>
> #include <array>
> #include <initializer_list>
>
> using namespace std;
>
> class A {
> public:
> A(array<int, 4>) {};
> };
>
> int main() {
> A a({1,2,3,4});
> }
>
> Its compilation fails on GCC 4.6
> I checked n3291 at 8.5.4/1, it seems here for constructing a is a
> direct-initialization, thus array's aggregation can be invoked. Am I
> right?
I've been bitten by this myself. 'array' is an aggregate, there is a long
thread on comp.std.c++ why, thus you have to replace the declaration of
'a' by
A a({{1,2,3,4}}); // note the double braces
Helmut.
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to comp.lang.c++.moderated | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
See if this usage about initializer_list is conforming to the final draft hayate <hayatelee@gmail.com> - 2011-06-09 07:02 -0600
Re: See if this usage about initializer_list is conforming to the final draft Daniel Krügler <daniel.kruegler@googlemail.com> - 2011-06-09 15:22 -0600
Re: See if this usage about initializer_list is conforming to the final draft Helmut Jarausch <jarausch@igpm.rwth-aachen.de> - 2011-06-09 15:54 -0600
Re: See if this usage about initializer_list is conforming to the final draft Daniel Krügler <daniel.kruegler@googlemail.com> - 2011-06-10 03:13 -0600
csiph-web