initializer_list in the VC10

Posted by user335870 on Stack Overflow See other posts from Stack Overflow or by user335870
Published on 2010-05-07T22:21:22Z Indexed on 2010/05/07 22:48 UTC
Read the original article Hit count: 267

Filed under:
|

hi i wrote this program in VC++ 2010:

class class1
{
public:
 class1 (initializer_list<int> a){};
 int foo;
 float Bar;
};
void main()
{
 class1 c = {2,3};
 getchar();
}

but i get this errors when i compile project:

Error 1 error C2552: 'c' : non-aggregates cannot be initialized with initializer list c:\users\pswin\documents\visual studio 2010\projects\test_c++0x\test_c++0x\main.cpp 27

and

2 IntelliSense: initialization with '{...}' is not allowed for object of type "class1" c:\users\pswin\documents\visual studio 2010\projects\test_c++0x\test_c++0x\main.cpp 27

what is the problem?

© Stack Overflow or respective owner

Related posts about c++0x

Related posts about initializer-list