[Lemon-commits] [lemon_svn] deba: r1849 - hugo/trunk/src/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:48:11 CET 2006
Author: deba
Date: Wed Apr 27 12:37:03 2005
New Revision: 1849
Modified:
hugo/trunk/src/lemon/xy.h
Log:
Changed input operator.
Modified: hugo/trunk/src/lemon/xy.h
==============================================================================
--- hugo/trunk/src/lemon/xy.h (original)
+++ hugo/trunk/src/lemon/xy.h Wed Apr 27 12:37:03 2005
@@ -159,11 +159,25 @@
///\relates xy
///
template<typename T>
- inline
- std::istream& operator>>(std::istream &is, xy<T> &z)
- {
-
- is >> z.x >> z.y;
+ inline std::istream& operator>>(std::istream &is, xy<T> &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<typename T>
- inline
- std::ostream& operator<<(std::ostream &os, xy<T> z)
+ inline std::ostream& operator<<(std::ostream &os, const xy<T>& z)
{
os << "(" << z.x << ", " << z.y << ")";
return os;
More information about the Lemon-commits
mailing list