C++ Multimap无匹配成员函数插入
C++ Multimap No Matching Member Function Insert
#include <map>
.
.
.
multimap<double, pair<int,int>> weightList;
for(int row = 0; row < matrixSize; row++ ){
for(int column = 0; column < matrixSize; column++){
double weight = matrix[row][column];
weightList.insert(weight,make_pair(row, column));
}
}
所以我收到一个错误 "no matching member function to call insert"。我不知道如何插入多图。如果您知道我还能如何插入多地图,我将不胜感激。
按照评论中的建议尝试
insert(std::make_pair(weight, std::make_pair(a,b)));
#include <map>
.
.
.
multimap<double, pair<int,int>> weightList;
for(int row = 0; row < matrixSize; row++ ){
for(int column = 0; column < matrixSize; column++){
double weight = matrix[row][column];
weightList.insert(weight,make_pair(row, column));
}
}
所以我收到一个错误 "no matching member function to call insert"。我不知道如何插入多图。如果您知道我还能如何插入多地图,我将不胜感激。
按照评论中的建议尝试
insert(std::make_pair(weight, std::make_pair(a,b)));