初始化程序列表在Visual Studio 2012 Update 2 CTP 4(3月) [英] Initializer list not working in Visual Studio 2012 Update 2 CTP 4 (March)

查看:154
本文介绍了初始化程序列表在Visual Studio 2012 Update 2 CTP 4(3月)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

安装Visual Studio 2012 Update 2 CTP 4(3月)后,此代码无法编译:

After installing Visual Studio 2012 Update 2 CTP 4 (March), this code doesn't compile:

vector<int> b = {1, 2, 3};

,并显示以下错误讯息:

with the following error message:

'std::vector<_Ty>' : Types with a base are not aggregate

以前的帖子有关与使用initializer_list标题提到的以前的CTP相同的问题,但CTP 4没有安装它。

Earlier post about the same issue with previous CTP mentioned using initializer_list header, but CTP 4 didn't install it. Any suggestions how to fix it?

推荐答案

编译器支持初始化列表,但是标准库(std :: vector等)才不是。你必须等待你的行编译。

The compiler supports initializer lists, but the standard library (std::vector etc.) does not. You will have to wait before your line compiles.

这篇关于初始化程序列表在Visual Studio 2012 Update 2 CTP 4(3月)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆