Search code examples
c++data-structuresassociative-arraymultimap

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));
    }
}

So I'm getting an error that says "no matching member function to call insert". I don't know how else to insert into a multimap. If you have any idea how else I could insert into the multi map I would really appreciate it.


Solution

  • As suggested in the comments try with

     insert(std::make_pair(weight, std::make_pair(a,b)));