Boost logo

Boost Users :

From: Kobi Cohen-Arazi (kobi.cohenarazi_at_[hidden])
Date: 2006-10-16 11:47:48


On 10/15/06, YYW <yyw1_25_at_[hidden]> wrote:
>
> Hello all,
> why the codes below is wrong in g++ 3.4.2?
> an error occurs in the line: cout<<CMatrix<double>::eye(5);

Whats the error?

Kobi.

--------------------------------------
> #include <ostream>
> #include <boost/numeric/ublas/matrix.hpp>
> #include <boost/numeric/ublas/io.hpp>
>
> using namespace boost::numeric::ublas;
> using namespace std;
>
> template <class T>
> class CMatrix
> {
> matrix<T>mat_;
>
> public:
> CMatrix(const identity_matrix<T>& m) { mat_ = m; }
> static CMatrix<T> eye(int size) { return identity_matrix<T>(size); }
>
> template <class T_>
> friend ostream& operator << (ostream& os, CMatrix<T_>& m);
> };
>
> template<class T_>
> ostream& operator << (ostream& os, CMatrix<T_>& m)
> {
> os<<m.mat_;
> return os;
> }
>
> int main()
> {
> CMatrix<double>I = CMatrix<double>::eye(5);
> cout<<I;
>
> cout<<CMatrix<double>::eye(5);//this line ==> error
> }
> ----------------------------------------
> Thanks in advance!
>
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>

-- 
- Kobi


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net