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