是否可以使用pythoncapi重载pythons+操作符
例如,如果我在python中运行此代码:
C = A+B
ID,能够调用C++中的函数
template<typename T>
QSMatrix<T> QSMatrix<T>::operator+(const QSMatrix<T>& rhs) {
QSMatrix result(rows, cols, 0.0);
for (unsigned i=0; i<rows; i++) {
for (unsigned j=0; j<cols; j++) {
result(i,j) = this->mat[i][j] + rhs(i,j);
}
}
return result;}
这样做可能吗
目前没有回答
相关问题 更多 >
编程相关推荐