问题
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