タグ付けされた質問 「ostream」

5
ostreamの<<演算子を適切にオーバーロードする方法は?
行列演算のためにC ++で小さな行列ライブラリを書いています。しかし、私のコンパイラは文句を言いますが、以前はそうではありませんでした。このコードは6か月間棚に置いたままで、その間にコンピュータをdebian etchからlenny(g ++(Debian 4.3.2-1.1)4.3.2)にアップグレードしましたが、同じg ++のUbuntuシステムでも同じ問題があります。 これが私のマトリックスクラスの関連部分です: namespace Math { class Matrix { public: [...] friend std::ostream&amp; operator&lt;&lt; (std::ostream&amp; stream, const Matrix&amp; matrix); } } そして「実装」: using namespace Math; std::ostream&amp; Matrix::operator &lt;&lt;(std::ostream&amp; stream, const Matrix&amp; matrix) { [...] } これはコンパイラーによって与えられたエラーです: matrix.cpp:459:エラー: 'std :: ostream&Math :: Matrix :: operator &lt;&lt;(std :: …
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.