lemon/core.h
 changeset 664 4137ef9aacc6 parent 628 aa1804409f29 child 686 72ac25ad276e
```     1.1 --- a/lemon/core.h	Fri Apr 24 10:15:33 2009 +0200
1.2 +++ b/lemon/core.h	Fri Apr 24 11:54:48 2009 +0200
1.3 @@ -1036,26 +1036,25 @@
1.4    ///\sa ArcLookUp, AllArcLookUp, DynArcLookUp
1.5    template <typename GR>
1.6    class ConArcIt : public GR::Arc {
1.7 +    typedef typename GR::Arc Parent;
1.8 +
1.9    public:
1.10
1.11 -    typedef GR Graph;
1.12 -    typedef typename Graph::Arc Parent;
1.13 -
1.14 -    typedef typename Graph::Arc Arc;
1.15 -    typedef typename Graph::Node Node;
1.16 +    typedef typename GR::Arc Arc;
1.17 +    typedef typename GR::Node Node;
1.18
1.19      /// \brief Constructor.
1.20      ///
1.21      /// Construct a new ConArcIt iterating on the arcs that
1.22      /// connects nodes \c u and \c v.
1.23 -    ConArcIt(const Graph& g, Node u, Node v) : _graph(g) {
1.24 +    ConArcIt(const GR& g, Node u, Node v) : _graph(g) {
1.25        Parent::operator=(findArc(_graph, u, v));
1.26      }
1.27
1.28      /// \brief Constructor.
1.29      ///
1.30      /// Construct a new ConArcIt that continues the iterating from arc \c a.
1.31 -    ConArcIt(const Graph& g, Arc a) : Parent(a), _graph(g) {}
1.32 +    ConArcIt(const GR& g, Arc a) : Parent(a), _graph(g) {}
1.33
1.34      /// \brief Increment operator.
1.35      ///
1.36 @@ -1066,7 +1065,7 @@
1.37        return *this;
1.38      }
1.39    private:
1.40 -    const Graph& _graph;
1.41 +    const GR& _graph;
1.42    };
1.43
1.44    namespace _core_bits {
1.45 @@ -1159,26 +1158,25 @@
1.46    ///\sa findEdge()
1.47    template <typename GR>
1.48    class ConEdgeIt : public GR::Edge {
1.49 +    typedef typename GR::Edge Parent;
1.50 +
1.51    public:
1.52
1.53 -    typedef GR Graph;
1.54 -    typedef typename Graph::Edge Parent;
1.55 -
1.56 -    typedef typename Graph::Edge Edge;
1.57 -    typedef typename Graph::Node Node;
1.58 +    typedef typename GR::Edge Edge;
1.59 +    typedef typename GR::Node Node;
1.60
1.61      /// \brief Constructor.
1.62      ///
1.63      /// Construct a new ConEdgeIt iterating on the edges that
1.64      /// connects nodes \c u and \c v.
1.65 -    ConEdgeIt(const Graph& g, Node u, Node v) : _graph(g), _u(u), _v(v) {
1.66 +    ConEdgeIt(const GR& g, Node u, Node v) : _graph(g), _u(u), _v(v) {
1.67        Parent::operator=(findEdge(_graph, _u, _v));
1.68      }
1.69
1.70      /// \brief Constructor.
1.71      ///
1.72      /// Construct a new ConEdgeIt that continues iterating from edge \c e.
1.73 -    ConEdgeIt(const Graph& g, Edge e) : Parent(e), _graph(g) {}
1.74 +    ConEdgeIt(const GR& g, Edge e) : Parent(e), _graph(g) {}
1.75
1.76      /// \brief Increment operator.
1.77      ///
1.78 @@ -1188,7 +1186,7 @@
1.79        return *this;
1.80      }
1.81    private:
1.82 -    const Graph& _graph;
1.83 +    const GR& _graph;
1.84      Node _u, _v;
1.85    };
1.86
1.87 @@ -1219,20 +1217,23 @@
1.88    class DynArcLookUp
1.89      : protected ItemSetTraits<GR, typename GR::Arc>::ItemNotifier::ObserverBase
1.90    {
1.91 -  public:
1.92      typedef typename ItemSetTraits<GR, typename GR::Arc>
1.93      ::ItemNotifier::ObserverBase Parent;
1.94
1.95      TEMPLATE_DIGRAPH_TYPEDEFS(GR);
1.96 +
1.97 +  public:
1.98 +
1.99 +    /// The Digraph type
1.100      typedef GR Digraph;
1.101
1.102    protected:
1.103
1.104      class AutoNodeMap : public ItemSetTraits<GR, Node>::template Map<Arc>::Type {
1.105 +      typedef typename ItemSetTraits<GR, Node>::template Map<Arc>::Type Parent;
1.106 +
1.107      public:
1.108
1.109 -      typedef typename ItemSetTraits<GR, Node>::template Map<Arc>::Type Parent;
1.110 -
1.111        AutoNodeMap(const GR& digraph) : Parent(digraph, INVALID) {}
1.112
1.113        virtual void add(const Node& node) {
1.114 @@ -1257,12 +1258,6 @@
1.115        }
1.116      };
1.117
1.118 -    const Digraph &_g;
1.120 -    typename Digraph::template ArcMap<Arc> _parent;
1.121 -    typename Digraph::template ArcMap<Arc> _left;
1.122 -    typename Digraph::template ArcMap<Arc> _right;
1.123 -
1.124      class ArcLess {
1.125        const Digraph &g;
1.126      public:
1.127 @@ -1273,6 +1268,14 @@
1.128        }
1.129      };
1.130
1.131 +  protected:
1.132 +
1.133 +    const Digraph &_g;
1.135 +    typename Digraph::template ArcMap<Arc> _parent;
1.136 +    typename Digraph::template ArcMap<Arc> _left;
1.137 +    typename Digraph::template ArcMap<Arc> _right;
1.138 +
1.139    public:
1.140
1.141      ///Constructor
1.142 @@ -1630,8 +1633,11 @@
1.143    template<class GR>
1.144    class ArcLookUp
1.145    {
1.146 +    TEMPLATE_DIGRAPH_TYPEDEFS(GR);
1.147 +
1.148    public:
1.149 -    TEMPLATE_DIGRAPH_TYPEDEFS(GR);
1.150 +
1.151 +    /// The Digraph type
1.152      typedef GR Digraph;
1.153
1.154    protected:
1.155 @@ -1746,9 +1752,8 @@
1.157
1.158      TEMPLATE_DIGRAPH_TYPEDEFS(GR);
1.159 -    typedef GR Digraph;
1.160
1.161 -    typename Digraph::template ArcMap<Arc> _next;
1.162 +    typename GR::template ArcMap<Arc> _next;
1.163