Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot convert argument 1 from int to int && error [duplicate]

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

like image 966
Marco Avatar asked Dec 19 '22 22:12

Marco


1 Answers

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));
like image 50
drescherjm Avatar answered Dec 22 '22 12:12

drescherjm