I am using VS2012, and I wanted to include the following map:
#include<iostream>
#include<map>
std::map<int, int> code_map = {
{65, 97},
{66, 98},
{67, 99},
{68, 100},
{69, 101},
{70, 102},
};
However, the IDE tells me
IntelliSense: Initialization with "{...}" invalid for object of type ""std::map, std::allocator>>""
Does anybody see why this error occurs? I guess that I am using C++11 if I use VS2012, so I thought that would work.
Thank you for the help.
Visual Studio 2012 doesn't support initializer lists. See this for the C++11 features it does support: http://msdn.microsoft.com/en-us/library/vstudio/hh567368%28v=vs.120%29.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With