COIN-OR::LEMON - Graph Library

Changeset 1392:b87aa8f0feb8 in lemon-0.x


Ignore:
Timestamp:
04/27/05 12:37:03 (19 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1849
Message:

Changed input operator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/xy.h

    r1391 r1392  
    160160  ///
    161161  template<typename T>
    162   inline
    163   std::istream& operator>>(std::istream &is, xy<T> &z)
    164   {
    165 
    166     is >> z.x >> z.y;
     162  inline std::istream& operator>>(std::istream &is, xy<T> &z) {
     163    char c;
     164    if (is >> c) {
     165      if (c != '(') is.putback(c);
     166    } else {
     167      is.clear();
     168    }
     169    if (!(is >> z.x)) return is;
     170    if (is >> c) {
     171      if (c != ',') is.putback(c);
     172    } else {
     173      is.clear();
     174    }
     175    if (!(is >> z.y)) return is;
     176    if (is >> c) {
     177      if (c != ')') is.putback(c);
     178    } else {
     179      is.clear();
     180    }
    167181    return is;
    168182  }
     
    174188  ///
    175189  template<typename T>
    176   inline
    177   std::ostream& operator<<(std::ostream &os, xy<T> z)
     190  inline std::ostream& operator<<(std::ostream &os, const xy<T>& z)
    178191  {
    179192    os << "(" << z.x << ", " << z.y << ")";
Note: See TracChangeset for help on using the changeset viewer.