# HG changeset patch # User deba # Date 1114598223 0 # Node ID b87aa8f0feb84709f2e0fefc1447dbabd7145074 # Parent 5b46af577b234a4db184b2521639bf5403a7485d Changed input operator. diff -r 5b46af577b23 -r b87aa8f0feb8 src/lemon/xy.h --- a/src/lemon/xy.h Tue Apr 26 15:50:30 2005 +0000 +++ b/src/lemon/xy.h Wed Apr 27 10:37:03 2005 +0000 @@ -159,11 +159,25 @@ ///\relates xy /// template - inline - std::istream& operator>>(std::istream &is, xy &z) - { - - is >> z.x >> z.y; + inline std::istream& operator>>(std::istream &is, xy &z) { + char c; + if (is >> c) { + if (c != '(') is.putback(c); + } else { + is.clear(); + } + if (!(is >> z.x)) return is; + if (is >> c) { + if (c != ',') is.putback(c); + } else { + is.clear(); + } + if (!(is >> z.y)) return is; + if (is >> c) { + if (c != ')') is.putback(c); + } else { + is.clear(); + } return is; } @@ -173,8 +187,7 @@ ///\relates xy /// template - inline - std::ostream& operator<<(std::ostream &os, xy z) + inline std::ostream& operator<<(std::ostream &os, const xy& z) { os << "(" << z.x << ", " << z.y << ")"; return os;