I am trying to initialize the map <ints, vector<ints> > using the new 0X standard, but I cannot understand that the syntax is correct. I would like to make a card with one record with a key: value = 1: <3,4>
#include <initializer_list> #include <map> #include <vector> using namespace std; map<int, vector<int> > A = {1,{3,4}}; ....
It dies with the following error using gcc 4.4.3:
error: no matching function for call to std::map<int,std::vector<int,std::allocator<int> >,std::less<int>,std::allocator<std::pair<const int,std::vector<int,std::allocator<int> > > > >::map(<brace-enclosed initializer list>)
Edit
Following Cogwheel's suggestion and adding an extra bracket, it now compiles with a warning that can get rid of the use of the -fno-deduce-init-list flag. Is there any danger?
c ++ c ++ 11 stl
Hooked
source share