What's wrong with this piece of code?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xz

    What's wrong with this piece of code?

    It's just a comman operator<<

    friend std::ostream& operator<<(std: :ostream& os, const Vertex& v){
    return os << "(" << v.getX() << ", " << v.getY()<< ")";
    };

    The compiling error is:

    Vertex.h: In function 'std::ostream& operator<<(std: :ostream&, const
    Vertex
    &)':
    Vertex.h:39: error: no match for 'operator<<' in 'os << "("'


    Am I missing some subtle mistake there?
  • xz

    #2
    Re: What's wrong with this piece of code?

    Oh, I figured it out.....

    Comment

    Working...