why does this fail to compile at the m_map.insert() call? Error
message follows code fragment.
#include <iostream>
#include <map>
using namespace std; //introduces namespace std
int foo( void )
{
map <int, int *> m_map;
int i = 10;
m_map.insert(1,&i);
}
------------------------
Error : function call 'insert(int, int *)' does not match
'std::map<int, int *, std::less<int>, std::allocator<std::pair<const
int, int *>>>::insert(const std::pair<const int, int *> &)'
'std::map<int, int *, std::less<int>, std::allocator<std::pair<const
int, int *>>>::insert(std::__tree<std::pair<const int, int *>,
std::map<int, int *, std::less<int>, std::allocator<std::pair<const
int, int *>>>::value_compare, std::allocator<std::pair<const int, int
*>>>::iterator, const std::pair<const int, int *> &)'
'std::map<int, int *, std::less<int>, std::allocator<std::pair<const
int, int *>>>::insert<...>(T1_0, T1_0)'
hello.cpp line 11 m_map.insert(1,&i); |