Add missing const keywords (+ remove misleading ones) (#67)
authorPeter Kovacs <kpeter@inf.elte.hu>
Fri, 12 Dec 2008 22:18:41 +0100
changeset 4489d9990909fc8
parent 447 3c0d39b6388c
child 449 91fcb8ed4cdc
Add missing const keywords (+ remove misleading ones) (#67)
lemon/adaptors.h
     1.1 --- a/lemon/adaptors.h	Fri Dec 12 22:09:29 2008 +0100
     1.2 +++ b/lemon/adaptors.h	Fri Dec 12 22:18:41 2008 +0100
     1.3 @@ -74,17 +74,17 @@
     1.4      int arcNum() const { return _digraph->arcNum(); }
     1.5  
     1.6      typedef FindArcTagIndicator<Digraph> FindArcTag;
     1.7 -    Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) {
     1.8 +    Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) const {
     1.9        return _digraph->findArc(u, v, prev);
    1.10      }
    1.11  
    1.12      Node addNode() { return _digraph->addNode(); }
    1.13      Arc addArc(const Node& u, const Node& v) { return _digraph->addArc(u, v); }
    1.14  
    1.15 -    void erase(const Node& n) const { _digraph->erase(n); }
    1.16 -    void erase(const Arc& a) const { _digraph->erase(a); }
    1.17 -
    1.18 -    void clear() const { _digraph->clear(); }
    1.19 +    void erase(const Node& n) { _digraph->erase(n); }
    1.20 +    void erase(const Arc& a) { _digraph->erase(a); }
    1.21 +
    1.22 +    void clear() { _digraph->clear(); }
    1.23  
    1.24      int id(const Node& n) const { return _digraph->id(n); }
    1.25      int id(const Arc& a) const { return _digraph->id(a); }
    1.26 @@ -205,12 +205,14 @@
    1.27      int edgeNum() const { return _graph->edgeNum(); }
    1.28  
    1.29      typedef FindArcTagIndicator<Graph> FindArcTag;
    1.30 -    Arc findArc(const Node& u, const Node& v, const Arc& prev = INVALID) {
    1.31 +    Arc findArc(const Node& u, const Node& v,
    1.32 +                const Arc& prev = INVALID) const {
    1.33        return _graph->findArc(u, v, prev);
    1.34      }
    1.35  
    1.36      typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
    1.37 -    Edge findEdge(const Node& u, const Node& v, const Edge& prev = INVALID) {
    1.38 +    Edge findEdge(const Node& u, const Node& v,
    1.39 +                  const Edge& prev = INVALID) const {
    1.40        return _graph->findEdge(u, v, prev);
    1.41      }
    1.42  
    1.43 @@ -336,7 +338,7 @@
    1.44  
    1.45      typedef FindArcTagIndicator<Digraph> FindArcTag;
    1.46      Arc findArc(const Node& u, const Node& v,
    1.47 -                const Arc& prev = INVALID) {
    1.48 +                const Arc& prev = INVALID) const {
    1.49        return Parent::findArc(v, u, prev);
    1.50      }
    1.51  
    1.52 @@ -475,7 +477,7 @@
    1.53  
    1.54      typedef FindArcTagIndicator<Digraph> FindArcTag;
    1.55      Arc findArc(const Node& source, const Node& target,
    1.56 -                const Arc& prev = INVALID) {
    1.57 +                const Arc& prev = INVALID) const {
    1.58        if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
    1.59          return INVALID;
    1.60        }
    1.61 @@ -618,7 +620,7 @@
    1.62  
    1.63      typedef FindArcTagIndicator<Digraph> FindArcTag;
    1.64      Arc findArc(const Node& source, const Node& target,
    1.65 -                const Arc& prev = INVALID) {
    1.66 +                const Arc& prev = INVALID) const {
    1.67        if (!(*_node_filter)[source] || !(*_node_filter)[target]) {
    1.68          return INVALID;
    1.69        }
    1.70 @@ -944,7 +946,7 @@
    1.71  
    1.72      typedef FindArcTagIndicator<Graph> FindArcTag;
    1.73      Arc findArc(const Node& u, const Node& v,
    1.74 -                const Arc& prev = INVALID) {
    1.75 +                const Arc& prev = INVALID) const {
    1.76        if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
    1.77          return INVALID;
    1.78        }
    1.79 @@ -957,7 +959,7 @@
    1.80  
    1.81      typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
    1.82      Edge findEdge(const Node& u, const Node& v,
    1.83 -                  const Edge& prev = INVALID) {
    1.84 +                  const Edge& prev = INVALID) const {
    1.85        if (!(*_node_filter_map)[u] || !(*_node_filter_map)[v]) {
    1.86          return INVALID;
    1.87        }
    1.88 @@ -1143,7 +1145,7 @@
    1.89  
    1.90      typedef FindArcTagIndicator<Graph> FindArcTag;
    1.91      Arc findArc(const Node& u, const Node& v,
    1.92 -                const Arc& prev = INVALID) {
    1.93 +                const Arc& prev = INVALID) const {
    1.94        Arc arc = Parent::findArc(u, v, prev);
    1.95        while (arc != INVALID && !(*_edge_filter_map)[arc]) {
    1.96          arc = Parent::findArc(u, v, arc);
    1.97 @@ -1153,7 +1155,7 @@
    1.98  
    1.99      typedef FindEdgeTagIndicator<Graph> FindEdgeTag;
   1.100      Edge findEdge(const Node& u, const Node& v,
   1.101 -                  const Edge& prev = INVALID) {
   1.102 +                  const Edge& prev = INVALID) const {
   1.103        Edge edge = Parent::findEdge(u, v, prev);
   1.104        while (edge != INVALID && !(*_edge_filter_map)[edge]) {
   1.105          edge = Parent::findEdge(u, v, edge);
   1.106 @@ -2243,7 +2245,7 @@
   1.107  
   1.108      typedef FindEdgeTagIndicator<Graph> FindArcTag;
   1.109      Arc findArc(const Node& u, const Node& v,
   1.110 -                const Arc& prev = INVALID) {
   1.111 +                const Arc& prev = INVALID) const {
   1.112        Arc arc = prev;
   1.113        bool d = arc == INVALID ? true : (*_direction)[arc];
   1.114        if (d) {
   1.115 @@ -3097,10 +3099,10 @@
   1.116    /// "Digraph concept". The type can be specified to be const.
   1.117    template <typename _Digraph>
   1.118    class SplitNodes
   1.119 -    : public DigraphAdaptorExtender<SplitNodesBase<_Digraph> > {
   1.120 +    : public DigraphAdaptorExtender<SplitNodesBase<const _Digraph> > {
   1.121    public:
   1.122      typedef _Digraph Digraph;
   1.123 -    typedef DigraphAdaptorExtender<SplitNodesBase<Digraph> > Parent;
   1.124 +    typedef DigraphAdaptorExtender<SplitNodesBase<const Digraph> > Parent;
   1.125  
   1.126      typedef typename Digraph::Node DigraphNode;
   1.127      typedef typename Digraph::Arc DigraphArc;
   1.128 @@ -3111,7 +3113,7 @@
   1.129      /// \brief Constructor of the adaptor.
   1.130      ///
   1.131      /// Constructor of the adaptor.
   1.132 -    SplitNodes(Digraph& g) {
   1.133 +    SplitNodes(const Digraph& g) {
   1.134        Parent::setDigraph(g);
   1.135      }
   1.136