#include" /> #include" /> #include"/>

Map insert is ambiguous

384 Views Asked by At

I am trying to use boost::container::map. During inserting data, the error "insert is ambiguous" is shown.

#include <boost/container/map.hpp>
#include <string>
#include <iostream>

int main()
{
  boost::container::map<std::string, int> map;
  map.insert("Ram",0);
}
1

There are 1 best solutions below

0
Nastaran Hakimi On

Your style of inserting is not correct. I provide the code:

#include <boost/container/map.hpp>
#include <string>
#include <iostream>
#include <ostream>

int main()
{
  boost::container::map<std::string, int> map;
  map.insert(std::pair<const std::string, int>("Ram",1));
  std::cout<< map["Ram"];
  return 0;
}