1.1 --- a/lemon/bits/map_extender.h Fri Nov 13 12:33:33 2009 +0100
1.2 +++ b/lemon/bits/map_extender.h Thu Dec 10 17:05:35 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() : map(NULL) {}
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() : map(NULL) {}
1.75 @@ -145,12 +149,12 @@
1.76 };
1.77
1.78 class ItemIt : public Item {
1.79 - public:
1.80 -
1.81 typedef Item Parent;
1.82
1.83 + public:
1.84 ItemIt() : map(NULL) {}
1.85
1.86 +
1.87 ItemIt(Invalid i) : Parent(i), map(NULL) {}
1.88
1.89 explicit ItemIt(Map& _map) : map(&_map) {
1.90 @@ -176,17 +180,20 @@
1.91 // \brief Extender for maps which use a subset of the items.
1.92 template <typename _Graph, typename _Map>
1.93 class SubMapExtender : public _Map {
1.94 + typedef _Map Parent;
1.95 + typedef _Graph GraphType;
1.96 +
1.97 public:
1.98
1.99 - typedef _Map Parent;
1.100 typedef SubMapExtender Map;
1.101 -
1.102 - typedef _Graph Graph;
1.103 -
1.104 typedef typename Parent::Key Item;
1.105
1.106 typedef typename Parent::Key Key;
1.107 typedef typename Parent::Value Value;
1.108 + typedef typename Parent::Reference Reference;
1.109 + typedef typename Parent::ConstReference ConstReference;
1.110 +
1.111 + typedef typename Parent::ReferenceMapTag ReferenceMapTag;
1.112
1.113 class MapIt;
1.114 class ConstMapIt;
1.115 @@ -196,10 +203,10 @@
1.116
1.117 public:
1.118
1.119 - SubMapExtender(const Graph& _graph)
1.120 + SubMapExtender(const GraphType& _graph)
1.121 : Parent(_graph), graph(_graph) {}
1.122
1.123 - SubMapExtender(const Graph& _graph, const Value& _value)
1.124 + SubMapExtender(const GraphType& _graph, const Value& _value)
1.125 : Parent(_graph, _value), graph(_graph) {}
1.126
1.127 private:
1.128 @@ -219,9 +226,9 @@
1.129
1.130 public:
1.131 class MapIt : public Item {
1.132 + typedef Item Parent;
1.133 +
1.134 public:
1.135 -
1.136 - typedef Item Parent;
1.137 typedef typename Map::Value Value;
1.138
1.139 MapIt() : map(NULL) {}
1.140 @@ -258,10 +265,10 @@
1.141 };
1.142
1.143 class ConstMapIt : public Item {
1.144 + typedef Item Parent;
1.145 +
1.146 public:
1.147
1.148 - typedef Item Parent;
1.149 -
1.150 typedef typename Map::Value Value;
1.151
1.152 ConstMapIt() : map(NULL) {}
1.153 @@ -289,12 +296,12 @@
1.154 };
1.155
1.156 class ItemIt : public Item {
1.157 - public:
1.158 -
1.159 typedef Item Parent;
1.160
1.161 + public:
1.162 ItemIt() : map(NULL) {}
1.163
1.164 +
1.165 ItemIt(Invalid i) : Parent(i), map(NULL) { }
1.166
1.167 explicit ItemIt(Map& _map) : map(&_map) {
1.168 @@ -316,7 +323,7 @@
1.169
1.170 private:
1.171
1.172 - const Graph& graph;
1.173 + const GraphType& graph;
1.174
1.175 };
1.176