我收到错误:
no matching function for call to ‘findByPosition::findByPosition(std::vector<int>::size_type&, std::vector<int>::size_type&)’
当我投射i
&时k
,int
我得到:
no matching function for call to ‘findByPosition::findByPosition(int, int)’
我不知道我的谓词有什么问题。我()
根据需要重载了运算符:
struct findByPosition
{
const Node needle;
findByPosition(const Node& sought) : needle(sought) {}
bool operator()(int i,int j) const
{
return ((needle.i == i) && (needle.j == j));
}
};
SparseMatrix& SparseMatrix::operator*=(const SparseMatrix &other)
{
SparseMatrix SparseMatrixResult(_numRow, other._numCol);
vector<Node>::iterator rowMulti, colMulti;
if(_numCol != other._numRow)
{
// error multiplying
}
for(std::vector<int>::size_type i = 0; i != (unsigned int)_numRow; i++) {
for(std::vector<int>::size_type j = 0; j != (unsigned int)_numCol; j++) {
for(std::vector<int>::size_type k = 0; k != (unsigned int)_numCol; k++)
{
rowMulti = find_if(_matrix.begin(), _matrix.end(), findByPosition(i,k));
}
}
}
*this = SparseMatrixResult;
return *this;
}
_matrix
是类型:
vector<Node> _matrix;