いくつかのハードコードされた値を持つペアのベクトルを初期化したいと思いますが、別のソリューションを使用しようとしましたが、コンパイルエラーが続きます。私のコードは次のようになります。ペアの初期化の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