QtConcurrent::mapped not compiling
QtConcurrent::mapped not compiling
我正在尝试使用QtConcurrent::mapped
,但我无法让它工作。它应该很简单:
class ChainInfo {
};
class Chain {
public:
ChainInfo GetInfo() const;
};
void CalculateInfo(QList<Chain *> Chains) const {
auto GetChainInfo = [](Chain const *pChain) {
return pChain->GetInfo();
};
auto ChainInfos = QtConcurrent::mapped(Chains, GetChainInfo);
}
我收到以下编译错误:
QtConcurrent/qtconcurrentmapkernel.h(162): error C2039: 'result_type': is not a member of 'CalculateInfo::<lambda_7571384993bda001f6e6e0e4e3ad7d4a>'
Link.cpp(193): note: see declaration of 'CalculateInfo::<lambda_7571384993bda001f6e6e0e4e3ad7d4a>'
QtConcurrent/qtconcurrentmapkernel.h(213): note: see reference to class template instantiation 'QtConcurrent::MappedEachKernel<QList<Chain *>::const_iterator,Functor>' being compiled
with
[
Functor=CalculateInfo::<lambda_7571384993bda001f6e6e0e4e3ad7d4a>
]
QtConcurrent/qtconcurrentmapkernel.h(237): note: see reference to class template instantiation 'QtConcurrent::SequenceHolder1<Sequence,QtConcurrent::MappedEachKernel<QList<Chain *>::const_iterator,Functor>,Functor>' being compiled
with
[
Sequence=QList<Chain *>,
Functor=CalculateInfo::<lambda_7571384993bda001f6e6e0e4e3ad7d4a>
]
qtconcurrentqtconcurrentmap.h(132): note: see reference to function template instantiation 'QtConcurrent::ThreadEngineStarter<void> QtConcurrent::startMapped<void,Sequence,T>(const Sequence &,Functor)' being compiled
with
[
Sequence=QList<Chain *>,
T=CalculateInfo::<lambda_7571384993bda001f6e6e0e4e3ad7d4a>,
Functor=CalculateInfo::<lambda_7571384993bda001f6e6e0e4e3ad7d4a>
]
Link.cpp(195): note: see reference to function template instantiation 'QFuture<void> QtConcurrent::mapped<QList<Chain *>,CalculateInfo::<lambda_7571384993bda001f6e6e0e4e3ad7d4a>>(const Sequence &,MapFunctor)' being compiled
with
[
Sequence=QList<Chain *>,
MapFunctor=CalculateInfo::<lambda_7571384993bda001f6e6e0e4e3ad7d4a>
]
QtConcurrent/qtconcurrentmapkernel.h(162): error C2146: syntax error: missing '>' before identifier 'result_type'
QtConcurrent/qtconcurrentmapkernel.h(165): error C2039: 'result_type': is not a member of 'CalculateInfo::<lambda_7571384993bda001f6e6e0e4e3ad7d4a>'
Link.cpp(193): note: see declaration of 'CalculateInfo::<lambda_7571384993bda001f6e6e0e4e3ad7d4a>'
QtConcurrent/qtconcurrentmapkernel.h(165): error C3646: 'T': unknown override specifier
QtConcurrent/qtconcurrentmapkernel.h(165): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
QtConcurrent/qtconcurrentmapkernel.h(167): error C3646: 'ReturnType': unknown override specifier
QtConcurrent/qtconcurrentmapkernel.h(167): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
QtConcurrent/qtconcurrentmapkernel.h(237): error C2440: 'return': cannot convert from 'QtConcurrent::ThreadEngineStarter<int>' to 'QtConcurrent::ThreadEngineStarter<void>'
QtConcurrent/qtconcurrentmapkernel.h(237): note: No constructor could take the source type, or constructor overload resolution was ambiguous
dpclosedguielement.cpp
dpclusterelement.cpp
dpdimensioncontroller.cpp
dpexternaldocumentsload.cpp
dpflowsymbol.cpp
dpguilink.cpp
dpguisymbol.cpp
任何想法可能出了什么问题?
我能够通过指定lambda函数的类型来解决它,而不仅仅是使用auto
:
std::function<ChainInfo(Chain const *)> GetChainInfo = [](Chain const *pChain) {
return pChain->GetInfo();
};
相关文章:
- OpenMP卸载说'fatal error: could not find accel/nvptx-none/mkoffload'
- 使用JsonCpp将数据返回到带有pybind11的python会在python调用中产生Symbol not foun
- OpenCV Android C++ imwrite not found
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- 使用单词"not"作为C ++类的名称会导致VS2019错误
- 错误"Could not find Boost"(缺少:上下文标头)
- 如何修复"error: ‘_1’ was not declared in this scope"?
- 套接字连接"Operation not permitted"错误,甚至使用升压/平发器根.cpp
- Is !NaN not a NaN?
- 为什么我会" void value not ignored as it ought to be"?
- 解决"ld: library not found for -ltensorflow_framework.2.3.0"
- 加载与引用 .NET DLL 位于同一文件夹中的引用的 .NET DLL 时"Not found"异常
- Directx 11 - CompileFromFile() is not compiling
- 方法错误"not all control paths return a value"和方法不返回值
- Centos7 g++ "to_string is not in a member of std"
- QtConcurrent::mapped not compiling
- boost multi_index_container not compiling
- Ubuntu OpenCV not compiling
- Microsoft Visual C++ Not Compiling
- C++ Hello World not compiling