Mar*_*rco 4 c++ visual-studio visual-studio-2013
今天我想尝试将我的项目从visual c ++ 2010带到visual c ++ 2013.
我在visual c ++ 2013中遇到了这个错误,这是我在编译2010版时没有得到的.
//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));
}
Run Code Online (Sandbox Code Playgroud)
错误是:
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 *&&'
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?为什么我在vc ++ 2010中没有出现任何错误?
谢谢
更改
Object_list.insert(std::make_pair<std::string,SimpleObject *>(Object_name, Object_pointer));
Run Code Online (Sandbox Code Playgroud)
至
Object_list.insert(std::make_pair(Object_name, Object_pointer));
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8462 次 |
最近记录: |