lemon/bits/map_extender.h
changeset 783 ef88c0a30f85
parent 617 4137ef9aacc6
child 802 994c7df296c9
     1.1 --- a/lemon/bits/map_extender.h	Mon Jan 12 23:11:39 2009 +0100
     1.2 +++ b/lemon/bits/map_extender.h	Thu Nov 05 15:48:01 2009 +0100
     1.3 @@ -36,17 +36,20 @@
     1.4    // \brief Extender for maps
     1.5    template <typename _Map>
     1.6    class MapExtender : public _Map {
     1.7 +    typedef _Map Parent;
     1.8 +    typedef typename Parent::GraphType GraphType;
     1.9 +
    1.10    public:
    1.11  
    1.12 -    typedef _Map Parent;
    1.13      typedef MapExtender Map;
    1.14 -
    1.15 -
    1.16 -    typedef typename Parent::Graph Graph;
    1.17      typedef typename Parent::Key Item;
    1.18  
    1.19      typedef typename Parent::Key Key;
    1.20      typedef typename Parent::Value Value;
    1.21 +    typedef typename Parent::Reference Reference;
    1.22 +    typedef typename Parent::ConstReference ConstReference;
    1.23 +
    1.24 +    typedef typename Parent::ReferenceMapTag ReferenceMapTag;
    1.25  
    1.26      class MapIt;
    1.27      class ConstMapIt;
    1.28 @@ -56,10 +59,10 @@
    1.29  
    1.30    public:
    1.31  
    1.32 -    MapExtender(const Graph& graph)
    1.33 +    MapExtender(const GraphType& graph)
    1.34        : Parent(graph) {}
    1.35  
    1.36 -    MapExtender(const Graph& graph, const Value& value)
    1.37 +    MapExtender(const GraphType& graph, const Value& value)
    1.38        : Parent(graph, value) {}
    1.39  
    1.40    private:
    1.41 @@ -75,9 +78,10 @@
    1.42  
    1.43    public:
    1.44      class MapIt : public Item {
    1.45 +      typedef Item Parent;
    1.46 +
    1.47      public:
    1.48  
    1.49 -      typedef Item Parent;
    1.50        typedef typename Map::Value Value;
    1.51  
    1.52        MapIt() {}
    1.53 @@ -114,10 +118,10 @@
    1.54      };
    1.55  
    1.56      class ConstMapIt : public Item {
    1.57 +      typedef Item Parent;
    1.58 +
    1.59      public:
    1.60  
    1.61 -      typedef Item Parent;
    1.62 -
    1.63        typedef typename Map::Value Value;
    1.64  
    1.65        ConstMapIt() {}
    1.66 @@ -145,10 +149,10 @@
    1.67      };
    1.68  
    1.69      class ItemIt : public Item {
    1.70 +      typedef Item Parent;
    1.71 +
    1.72      public:
    1.73  
    1.74 -      typedef Item Parent;
    1.75 -
    1.76        ItemIt() {}
    1.77  
    1.78        ItemIt(Invalid i) : Parent(i) { }
    1.79 @@ -176,17 +180,20 @@
    1.80    // \brief Extender for maps which use a subset of the items.
    1.81    template <typename _Graph, typename _Map>
    1.82    class SubMapExtender : public _Map {
    1.83 +    typedef _Map Parent;
    1.84 +    typedef _Graph GraphType;
    1.85 +
    1.86    public:
    1.87  
    1.88 -    typedef _Map Parent;
    1.89      typedef SubMapExtender Map;
    1.90 -
    1.91 -    typedef _Graph Graph;
    1.92 -
    1.93      typedef typename Parent::Key Item;
    1.94  
    1.95      typedef typename Parent::Key Key;
    1.96      typedef typename Parent::Value Value;
    1.97 +    typedef typename Parent::Reference Reference;
    1.98 +    typedef typename Parent::ConstReference ConstReference;
    1.99 +
   1.100 +    typedef typename Parent::ReferenceMapTag ReferenceMapTag;
   1.101  
   1.102      class MapIt;
   1.103      class ConstMapIt;
   1.104 @@ -196,10 +203,10 @@
   1.105  
   1.106    public:
   1.107  
   1.108 -    SubMapExtender(const Graph& _graph)
   1.109 +    SubMapExtender(const GraphType& _graph)
   1.110        : Parent(_graph), graph(_graph) {}
   1.111  
   1.112 -    SubMapExtender(const Graph& _graph, const Value& _value)
   1.113 +    SubMapExtender(const GraphType& _graph, const Value& _value)
   1.114        : Parent(_graph, _value), graph(_graph) {}
   1.115  
   1.116    private:
   1.117 @@ -219,9 +226,9 @@
   1.118  
   1.119    public:
   1.120      class MapIt : public Item {
   1.121 +      typedef Item Parent;
   1.122 +
   1.123      public:
   1.124 -
   1.125 -      typedef Item Parent;
   1.126        typedef typename Map::Value Value;
   1.127  
   1.128        MapIt() {}
   1.129 @@ -258,10 +265,10 @@
   1.130      };
   1.131  
   1.132      class ConstMapIt : public Item {
   1.133 +      typedef Item Parent;
   1.134 +
   1.135      public:
   1.136  
   1.137 -      typedef Item Parent;
   1.138 -
   1.139        typedef typename Map::Value Value;
   1.140  
   1.141        ConstMapIt() {}
   1.142 @@ -289,10 +296,10 @@
   1.143      };
   1.144  
   1.145      class ItemIt : public Item {
   1.146 +      typedef Item Parent;
   1.147 +
   1.148      public:
   1.149  
   1.150 -      typedef Item Parent;
   1.151 -
   1.152        ItemIt() {}
   1.153  
   1.154        ItemIt(Invalid i) : Parent(i) { }
   1.155 @@ -316,7 +323,7 @@
   1.156  
   1.157    private:
   1.158  
   1.159 -    const Graph& graph;
   1.160 +    const GraphType& graph;
   1.161  
   1.162    };
   1.163