Cascading Member Functions

Pages: 12
still doesn't work.. :( had class which is why the delay in repsonse.

57 main.cpp res1 ^ T ^ T = \n")) << Matrix::transpose()()'
More debugging codes:

note C:\Dev-Cpp\include\c++\3.4.2\bits\ostream.tcc:63 candidates are: std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>&(*)(std::basic_ostream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]

note C:\Dev-Cpp\include\c++\3.4.2\bits\ostream.tcc:63 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ios<_CharT, _Traits>&(*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]

note C:\Dev-Cpp\include\c++\3.4.2\bits\ostream.tcc:63 std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base&(*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>]

and like 15 more ...

this only appears when i have this statement typed:
cout << res1.transpose().transpose();

but works fine like this:
1
2
3
    
res1.transpose().transpose();
cout << res1
Last edited on
Figured it out.. it didn't like taking the & operator in my ostream code.. works fine now :)
perhabs you dont have the keyword const before your Matrix object, be sure you put the keyword const.

ostream& operator(ostream& out, const Matrix& target);

or
ostream& operator(ostream& out, Matrix const& target);

than

cout << res1.transpose().transpose();

It work too
Topic archived. No new replies allowed.
Pages: 12