【发布时间】:2011-10-22 14:54:36
【问题描述】:
我有一个 Matrix 类,它带有一个与 operator> >),我现在想部分地专门化该友元函数以使其工作方式不同。在类定义中,我首先拥有
template <typename U>
friend std::ostream& operator<<(std::ostream& output, const Matrix<U>& other);
我尝试添加
friend std::ostream& operator<<(std::ostream& output, const Matrix<Matrix<char> >& other);
但这给了我来自编译器的多个声明错误。 我似乎无法弄清楚如何做到这一点。
【问题讨论】:
标签: c++ template-specialization ostream friend-function