lemon/bits/map_extender.h
changeset 617 4137ef9aacc6
parent 580 2313edd0db0b
child 718 703ebf476a1d
     1.1 --- a/lemon/bits/map_extender.h	Fri Apr 24 10:15:33 2009 +0200
     1.2 +++ b/lemon/bits/map_extender.h	Fri Apr 24 11:54:48 2009 +0200
     1.3 @@ -36,13 +36,12 @@
     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 @@ -58,10 +57,10 @@
    1.21  
    1.22    public:
    1.23  
    1.24 -    MapExtender(const Graph& graph)
    1.25 +    MapExtender(const GraphType& graph)
    1.26        : Parent(graph) {}
    1.27  
    1.28 -    MapExtender(const Graph& graph, const Value& value)
    1.29 +    MapExtender(const GraphType& graph, const Value& value)
    1.30        : Parent(graph, value) {}
    1.31  
    1.32    private:
    1.33 @@ -77,9 +76,10 @@
    1.34  
    1.35    public:
    1.36      class MapIt : public Item {
    1.37 +      typedef Item Parent;
    1.38 +
    1.39      public:
    1.40  
    1.41 -      typedef Item Parent;
    1.42        typedef typename Map::Value Value;
    1.43  
    1.44        MapIt() {}
    1.45 @@ -116,10 +116,10 @@
    1.46      };
    1.47  
    1.48      class ConstMapIt : public Item {
    1.49 +      typedef Item Parent;
    1.50 +
    1.51      public:
    1.52  
    1.53 -      typedef Item Parent;
    1.54 -
    1.55        typedef typename Map::Value Value;
    1.56  
    1.57        ConstMapIt() {}
    1.58 @@ -147,10 +147,10 @@
    1.59      };
    1.60  
    1.61      class ItemIt : public Item {
    1.62 +      typedef Item Parent;
    1.63 +
    1.64      public:
    1.65  
    1.66 -      typedef Item Parent;
    1.67 -
    1.68        ItemIt() {}
    1.69  
    1.70        ItemIt(Invalid i) : Parent(i) { }
    1.71 @@ -178,13 +178,12 @@
    1.72    // \brief Extender for maps which use a subset of the items.
    1.73    template <typename _Graph, typename _Map>
    1.74    class SubMapExtender : public _Map {
    1.75 +    typedef _Map Parent;
    1.76 +    typedef _Graph GraphType;
    1.77 +
    1.78    public:
    1.79  
    1.80 -    typedef _Map Parent;
    1.81      typedef SubMapExtender Map;
    1.82 -
    1.83 -    typedef _Graph Graph;
    1.84 -
    1.85      typedef typename Parent::Key Item;
    1.86  
    1.87      typedef typename Parent::Key Key;
    1.88 @@ -200,10 +199,10 @@
    1.89  
    1.90    public:
    1.91  
    1.92 -    SubMapExtender(const Graph& _graph)
    1.93 +    SubMapExtender(const GraphType& _graph)
    1.94        : Parent(_graph), graph(_graph) {}
    1.95  
    1.96 -    SubMapExtender(const Graph& _graph, const Value& _value)
    1.97 +    SubMapExtender(const GraphType& _graph, const Value& _value)
    1.98        : Parent(_graph, _value), graph(_graph) {}
    1.99  
   1.100    private:
   1.101 @@ -223,9 +222,9 @@
   1.102  
   1.103    public:
   1.104      class MapIt : public Item {
   1.105 +      typedef Item Parent;
   1.106 +
   1.107      public:
   1.108 -
   1.109 -      typedef Item Parent;
   1.110        typedef typename Map::Value Value;
   1.111  
   1.112        MapIt() {}
   1.113 @@ -262,10 +261,10 @@
   1.114      };
   1.115  
   1.116      class ConstMapIt : public Item {
   1.117 +      typedef Item Parent;
   1.118 +
   1.119      public:
   1.120  
   1.121 -      typedef Item Parent;
   1.122 -
   1.123        typedef typename Map::Value Value;
   1.124  
   1.125        ConstMapIt() {}
   1.126 @@ -293,10 +292,10 @@
   1.127      };
   1.128  
   1.129      class ItemIt : public Item {
   1.130 +      typedef Item Parent;
   1.131 +
   1.132      public:
   1.133  
   1.134 -      typedef Item Parent;
   1.135 -
   1.136        ItemIt() {}
   1.137  
   1.138        ItemIt(Invalid i) : Parent(i) { }
   1.139 @@ -320,7 +319,7 @@
   1.140  
   1.141    private:
   1.142  
   1.143 -    const Graph& graph;
   1.144 +    const GraphType& graph;
   1.145  
   1.146    };
   1.147