cannot convert argument 1 from int to int && error
10,203
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));
Author by
Marco
Updated on June 16, 2022Comments
-
Marco almost 2 years
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
-
drescherjm over 10 yearsFor a better description why this is required look here: stackoverflow.com/questions/9641960/…
-
drescherjm over 10 years@Marco see my comment added a few seconds before your last comment.