Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ C++;,Visual Studio:意外的std::异步返回类型_C++_Visual Studio_Future_Stdasync - Fatal编程技术网

C++ C++;,Visual Studio:意外的std::异步返回类型

C++ C++;,Visual Studio:意外的std::异步返回类型,c++,visual-studio,future,stdasync,C++,Visual Studio,Future,Stdasync,我正在尝试在QMap中保存多个std::futures。QMap是我的类的成员变量: QMap线程; 现在,我想在此映射中存储多个std::async调用的结果,如下所示: this->threads.insert(文件名,std::async(std::launch::async,&mainterface::readImage,this,path,true)); 此处异步调用的函数readImage,如下所示: cv::Mat MainInterface::readImage(QStrin

我正在尝试在
QMap
中保存多个
std::future
s。
QMap
是我的类的成员变量:

QMap线程;
现在,我想在此映射中存储多个
std::async
调用的结果,如下所示:

this->threads.insert(文件名,std::async(std::launch::async,&mainterface::readImage,this,path,true));
此处异步调用的函数
readImage
,如下所示:

cv::Mat MainInterface::readImage(QString路径,布尔信号){
//一些代码
返回图像;
}
所以异步函数的返回值应该是
std::future
。但是,在尝试编译时,Visual Studio 2015给了我以下compier错误:

重载函数“QMap::insert[with Key=QString,T=std::future]”的实例与参数列表不匹配,参数类型为:(QString,std::future),对象类型为:QMap

让我困惑的是返回类型
std::future
,它不同于我预期的
std::future

std::future
不可复制,是否
QMap::insert
仅用于移动类型?你用
std::shared_future
检查过了吗?没有,我还没有用
std::shared_future
试过。如果我使用
操作符[]
插入
QMap
,IntelliSense仍会向我显示错误消息,但程序会编译并启动。这看起来像是IntelliSense错误。什么是MSVC编译器错误?查看“输出”选项卡而不是“错误列表”选项卡可能会很有用。我发布的是实际的编译器错误,而不是IntelliSense消息。如果我按照上面的注释修改代码,则没有编译器错误(但是,仍然是IntelliSense消息)。MSVC错误的错误代码形式为
Cxxxx
;这个有什么错误代码?