Today I wanted to try to bring my project from visual c++ 2010 to visual c++ 2013.
I get this error in visual c++ 2013 which I did not get when compiling with 2010 version.
//somewhere in the SimpleObject_list class
std::unordered_map<std::string, SimpleObject *> Object_list;
//method which is giving me the error
void SimpleObject_list::Add(const char *Object_name, SimpleObject * Object_pointer){
cout << "SimpleObject listed as: " << Object_name << endl;
Object_list.insert(std::make_pair<std::string,SimpleObject *>(Object_name, Object_pointer));
}
the error is:
error C2664: 'std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,SimpleObject *> std::make_pair<std::string,SimpleObject*>(_Ty1 &&,_Ty2 &&)' : cannot convert argument 2 from 'SimpleObject *' to 'SimpleObject *&&'
what am I doing wrong? Why I did not get any error in vc++ 2010?
Thanks
Change
Object_list.insert(std::make_pair<std::string,SimpleObject *>(Object_name, Object_pointer));
to
Object_list.insert(std::make_pair(Object_name, Object_pointer));
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