开发者

Am I failing to follow the standard?

If I have something like this:

MyStruct clip;

clip = {16, 16, 16, 16};

I get the following warning from the compiler: warning: extended initializer lists only available with -std=c++0x or -std=gnu++0x

If I active -std=c++0x in the compiler, it does not give any warning. But I'm not sure if I am following the standard. So should I deactivate 开发者_StackOverflow中文版that flag and initialize each member of the structure separately?

Thank you.


For initialization you should be able to use MyStruct clip = {16, 16, 16, 16}; but as you discovered in the current C++ standard you can't assign to a bracketed list. In C++1x you can use the extended syntax.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜