search

Home  >  Q&A  >  body text

C++ error C2678: binary '<<': no ​​operator found accepting left operand of type 'const std::ostream'

I called the operator<< of SortedSinglyList in LinkedMatrix's operator<<, and determined that the error was in the marked line. Is this error related to const? But none of the code I wrote here contains const

I ran operator<< in SSL correctly, but LM failed

class LinkedMatrix-------
friend ostream& operator<<<>(ostream& os, LinkedMatrix &a)

{
    for (int i = 0; i < a.rows; i++)
        cout << "i" << (*a.rowlist[i]);   //括号相当于SSL对象。调用SSL.operator<<
    
}

为情所困为情所困2813 days ago1203

reply all(1)I'll reply

  • 仅有的幸福

    仅有的幸福2017-06-05 11:13:05

    operator<<<>What is this<> of yours?

    reply
    0
  • Cancelreply