rozi
rozi

Reputation: 166

error in friend function syntax using templates c++

I am writing a class representing a Matrix and encountered an error: "expected ‘)’ before ‘<’ token" on the second to last line.

template<typename T>
class Matrix;

template<typename T>
Matrix<T> operator-(const Matrix<T> &self);

template<typename T>
ostream & operator<<(ostream &out, const Matrix<T> &matrix);

template<typename T> class Matrix
{
public:
    friend ostream & (operator<<<> )(ostream &out, const Matrix &matrix);

    friend Matrix (operator-<>)(const Matrix &self); //error here
};

Upvotes: 0

Views: 40

Answers (1)

rozi
rozi

Reputation: 166

Must have been a bug with eclipse using Linux GCC. Solved it by compiling with a different compiler.

Upvotes: 1

Related Questions