lemon/bits/graph_extender.h
changeset 783 ef88c0a30f85
parent 685 a27356ceb5bd
child 998 7fdaa05a69a1
     1.1 --- a/lemon/bits/graph_extender.h	Mon Jan 12 23:11:39 2009 +0100
     1.2 +++ b/lemon/bits/graph_extender.h	Thu Nov 05 15:48:01 2009 +0100
     1.3 @@ -37,9 +37,10 @@
     1.4    // \brief Extender for the digraph implementations
     1.5    template <typename Base>
     1.6    class DigraphExtender : public Base {
     1.7 +    typedef Base Parent;
     1.8 +
     1.9    public:
    1.10  
    1.11 -    typedef Base Parent;
    1.12      typedef DigraphExtender Digraph;
    1.13  
    1.14      // Base extensions
    1.15 @@ -55,11 +56,11 @@
    1.16        return Parent::maxArcId();
    1.17      }
    1.18  
    1.19 -    Node fromId(int id, Node) const {
    1.20 +    static Node fromId(int id, Node) {
    1.21        return Parent::nodeFromId(id);
    1.22      }
    1.23  
    1.24 -    Arc fromId(int id, Arc) const {
    1.25 +    static Arc fromId(int id, Arc) {
    1.26        return Parent::arcFromId(id);
    1.27      }
    1.28  
    1.29 @@ -218,10 +219,9 @@
    1.30      template <typename _Value>
    1.31      class NodeMap
    1.32        : public MapExtender<DefaultMap<Digraph, Node, _Value> > {
    1.33 -    public:
    1.34 -      typedef DigraphExtender Digraph;
    1.35        typedef MapExtender<DefaultMap<Digraph, Node, _Value> > Parent;
    1.36  
    1.37 +    public:
    1.38        explicit NodeMap(const Digraph& digraph)
    1.39          : Parent(digraph) {}
    1.40        NodeMap(const Digraph& digraph, const _Value& value)
    1.41 @@ -243,10 +243,9 @@
    1.42      template <typename _Value>
    1.43      class ArcMap
    1.44        : public MapExtender<DefaultMap<Digraph, Arc, _Value> > {
    1.45 -    public:
    1.46 -      typedef DigraphExtender Digraph;
    1.47        typedef MapExtender<DefaultMap<Digraph, Arc, _Value> > Parent;
    1.48  
    1.49 +    public:
    1.50        explicit ArcMap(const Digraph& digraph)
    1.51          : Parent(digraph) {}
    1.52        ArcMap(const Digraph& digraph, const _Value& value)
    1.53 @@ -330,9 +329,10 @@
    1.54    // \brief Extender for the Graphs
    1.55    template <typename Base>
    1.56    class GraphExtender : public Base {
    1.57 +    typedef Base Parent;
    1.58 +
    1.59    public:
    1.60  
    1.61 -    typedef Base Parent;
    1.62      typedef GraphExtender Graph;
    1.63  
    1.64      typedef True UndirectedTag;
    1.65 @@ -355,15 +355,15 @@
    1.66        return Parent::maxEdgeId();
    1.67      }
    1.68  
    1.69 -    Node fromId(int id, Node) const {
    1.70 +    static Node fromId(int id, Node) {
    1.71        return Parent::nodeFromId(id);
    1.72      }
    1.73  
    1.74 -    Arc fromId(int id, Arc) const {
    1.75 +    static Arc fromId(int id, Arc) {
    1.76        return Parent::arcFromId(id);
    1.77      }
    1.78  
    1.79 -    Edge fromId(int id, Edge) const {
    1.80 +    static Edge fromId(int id, Edge) {
    1.81        return Parent::edgeFromId(id);
    1.82      }
    1.83  
    1.84 @@ -601,11 +601,10 @@
    1.85      template <typename _Value>
    1.86      class NodeMap
    1.87        : public MapExtender<DefaultMap<Graph, Node, _Value> > {
    1.88 -    public:
    1.89 -      typedef GraphExtender Graph;
    1.90        typedef MapExtender<DefaultMap<Graph, Node, _Value> > Parent;
    1.91  
    1.92 -      NodeMap(const Graph& graph)
    1.93 +    public:
    1.94 +      explicit NodeMap(const Graph& graph)
    1.95          : Parent(graph) {}
    1.96        NodeMap(const Graph& graph, const _Value& value)
    1.97          : Parent(graph, value) {}
    1.98 @@ -626,11 +625,10 @@
    1.99      template <typename _Value>
   1.100      class ArcMap
   1.101        : public MapExtender<DefaultMap<Graph, Arc, _Value> > {
   1.102 -    public:
   1.103 -      typedef GraphExtender Graph;
   1.104        typedef MapExtender<DefaultMap<Graph, Arc, _Value> > Parent;
   1.105  
   1.106 -      ArcMap(const Graph& graph)
   1.107 +    public:
   1.108 +      explicit ArcMap(const Graph& graph)
   1.109          : Parent(graph) {}
   1.110        ArcMap(const Graph& graph, const _Value& value)
   1.111          : Parent(graph, value) {}
   1.112 @@ -651,11 +649,10 @@
   1.113      template <typename _Value>
   1.114      class EdgeMap
   1.115        : public MapExtender<DefaultMap<Graph, Edge, _Value> > {
   1.116 -    public:
   1.117 -      typedef GraphExtender Graph;
   1.118        typedef MapExtender<DefaultMap<Graph, Edge, _Value> > Parent;
   1.119  
   1.120 -      EdgeMap(const Graph& graph)
   1.121 +    public:
   1.122 +      explicit EdgeMap(const Graph& graph)
   1.123          : Parent(graph) {}
   1.124  
   1.125        EdgeMap(const Graph& graph, const _Value& value)