Initializer list not working in Visual Studio 2012 Update 2 CTP 4 (March)

人走茶凉 提交于 2019-12-24 20:28:35

问题


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

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?


回答1:


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



来源:https://stackoverflow.com/questions/15238442/initializer-list-not-working-in-visual-studio-2012-update-2-ctp-4-march

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