src/lemon/path.h
changeset 1347 c0f6f251e893
parent 1228 0a7719037acb
child 1359 1581f961cfaa
equal deleted inserted replaced
5:e9e0af4f8b59 6:14c66d5ca3d2
   100       gr = P.gr;
   100       gr = P.gr;
   101       edges.insert(edges.end(), P.edges.begin()+a.idx, P.edges.begin()+b.idx);
   101       edges.insert(edges.end(), P.edges.begin()+a.idx, P.edges.begin()+b.idx);
   102     }
   102     }
   103 
   103 
   104     /// Length of the path.
   104     /// Length of the path.
   105     size_t length() const { return edges.size(); }
   105     int length() const { return edges.size(); }
   106     /// Returns whether the path is empty.
   106     /// Returns whether the path is empty.
   107     bool empty() const { return edges.empty(); }
   107     bool empty() const { return edges.empty(); }
   108 
   108 
   109     /// Resets the path to an empty path.
   109     /// Resets the path to an empty path.
   110     void clear() { edges.clear(); }
   110     void clear() { edges.clear(); }
   195       bool operator!=(const EdgeIt& e) const { return idx!=e.idx; }
   195       bool operator!=(const EdgeIt& e) const { return idx!=e.idx; }
   196       /// Comparison operator
   196       /// Comparison operator
   197       bool operator<(const EdgeIt& e) const { return idx<e.idx; }
   197       bool operator<(const EdgeIt& e) const { return idx<e.idx; }
   198 
   198 
   199     private:
   199     private:
   200       // FIXME: comparison between signed and unsigned...
   200       void validate() { if(idx >= p->length() ) idx=-1; }
   201       // Jo ez igy? Vagy esetleg legyen a length() int?
       
   202       void validate() { if( size_t(idx) >= p->length() ) idx=-1; }
       
   203     };
   201     };
   204 
   202 
   205     /**
   203     /**
   206      * \brief Iterator class to iterate on the nodes of the paths
   204      * \brief Iterator class to iterate on the nodes of the paths
   207      *
   205      *
   245       bool operator!=(const NodeIt& e) const { return idx!=e.idx; }
   243       bool operator!=(const NodeIt& e) const { return idx!=e.idx; }
   246       /// Comparison operator
   244       /// Comparison operator
   247       bool operator<(const NodeIt& e) const { return idx<e.idx; }
   245       bool operator<(const NodeIt& e) const { return idx<e.idx; }
   248 
   246 
   249     private:
   247     private:
   250       void validate() { if( size_t(idx) > p->length() ) idx=-1; }
   248       void validate() { if(idx > p->length() ) idx=-1; }
   251     };
   249     };
   252 
   250 
   253     friend class Builder;
   251     friend class Builder;
   254 
   252 
   255     /**
   253     /**