问题描述
在C ++编程语言的第四版中,Stroustrup博士使用一个示例来计算两个矩阵的结果,以演示decltype()说明符。我的问题是在第一部分中括号后面的箭头运算符->之间的关系。声明的结果在此代码中是否为引用? (以auto operator +(const ...)开头的部分
template<typename T,typename U>
auto operator+(const Matrix<T>& a,const Matrix<U>& b)-> Matrix<decltype(T{}+U{})>
{
Matrix<decltype(T{}+U{})> rest;
for (int i=0; i!=a.rows(); ++i)
for (int j=0; j!=a.cols(); ++j)
res(i,j) += a(i,j) + b(i,j);
return res;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)