initializer_list not working in VC10

 ̄綄美尐妖づ 提交于 2019-12-04 00:49:16
Georg Fritzsche

It shouldn't be supported at all:

[...] the C++0x Core Language feature of initializer lists and the associated Standard Library changes weren't implemented in VC10.

The error message refers to the pre-C++0x feature of aggregate initialization, which allows the initialization of certain user-defined types by using curly braces:

struct pair { int first; char second; };
pair p = { 0, 'c' };

Aggregates are defined in §8.5.1:

An aggregate is an array or a class (clause 9) with no user-declared constructors (12.1), no private or protected non-static data members (clause 11), no base classes (clause 10), and no virtual functions (10.3).

When an aggregate is initialized the initializer can contain an initializer-clause consisting of a brace- enclosed, comma-separated list of initializer-clauses for the members of the aggregate, written in increasing subscript or member order. If the aggregate contains subaggregates, this rule applies recursively to the members of the subaggregate.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!