0
我想用一些硬编码值初始化一个向量对,我尝试过使用不同的解决方案,但是我一直收到编译错误。我的代码如下所示:C++向量对初始化 - 编译错误
std::vector<std::pair<cv::HOGDescriptor, std::ifstream> > hogs_files = {
std::make_pair(hog, file),
std::make_pair(hog2, file2),
std::make_pair(hog3, file3),
std::make_pair(hog4, file4),
std::make_pair(hog5, file5),
std::make_pair(hog6, file6),
std::make_pair(hog7, file7),
std::make_pair(hog8, file8)
};
,我已经得到了错误的是:
Error C2440 '<function-style-cast>': cannot convert from 'initializer list' to '_Mypair'
感谢您的答案。
请删除'='。 –
它没有帮助 – mcjay
哪个编译器? – Arunmu