1.1 --- a/src/hugo/vector_map_factory.h Fri Sep 03 14:26:03 2004 +0000
1.2 +++ b/src/hugo/vector_map_factory.h Fri Sep 03 15:11:17 2004 +0000
1.3 @@ -17,7 +17,7 @@
1.4
1.5 /** The VectorMapFactory template class is a factory class
1.6 * to create maps for the edge and nodes. This map factory
1.7 - * use the std::vector to implement the container function.
1.8 + * uses the std::vector to implement the container function.
1.9 *
1.10 * The template parameter is the MapRegistry that the maps
1.11 * will belong to.
1.12 @@ -42,12 +42,27 @@
1.13 */
1.14 template <typename V>
1.15 class Map : public MapBase {
1.16 +
1.17 + typedef std::vector<V> Container;
1.18 +
1.19 public:
1.20
1.21 /// The value type of the map.
1.22 + typedef V ValueType;
1.23 +
1.24 + /// The value type of the map.
1.25 typedef V Value;
1.26 + /// The reference type of the map;
1.27 + typedef typename Container::reference Reference;
1.28 + /// The pointer type of the map;
1.29 + typedef typename Container::pointer Pointer;
1.30
1.31 - typedef std::vector<Value> Container;
1.32 + /// The const value type of the map.
1.33 + typedef const Value ConstValue;
1.34 + /// The const reference type of the map;
1.35 + typedef typename Container::const_reference ConstReference;
1.36 + /// The pointer type of the map;
1.37 + typedef typename Container::const_pointer ConstPointer;
1.38
1.39 /** Default constructor for the map.
1.40 */
1.41 @@ -64,7 +79,7 @@
1.42 Map(const Graph& g, MapRegistry& r, const Value& v) : MapBase(g, r) {
1.43 for (KeyIt it(*getGraph()); it != INVALID; ++it) {
1.44 int id = getGraph()->id(it);
1.45 - if (id >= container.size()) {
1.46 + if (id >= (int)container.size()) {
1.47 container.resize(id + 1);
1.48 }
1.49 set(it, v);
1.50 @@ -77,7 +92,7 @@
1.51 if (getGraph()) {
1.52 for (KeyIt it(*getGraph()); it != INVALID; ++it) {
1.53 int id = getGraph()->id(it);
1.54 - if (id >= container.size()) {
1.55 + if (id >= (int)container.size()) {
1.56 container.resize(id + 1);
1.57 }
1.58 set(it, copy[it]);
1.59 @@ -95,12 +110,13 @@
1.60 if (getGraph()) {
1.61 for (KeyIt it(*getGraph()); it != INVALID; ++it) {
1.62 int id = getGraph()->id(it);
1.63 - if (id >= container.size()) {
1.64 + if (id >= (int)container.size()) {
1.65 container.resize(id + 1);
1.66 }
1.67 set(it, copy[it]);
1.68 }
1.69 }
1.70 + return *this;
1.71 }
1.72
1.73 /** The destructor of the map.
1.74 @@ -112,7 +128,11 @@
1.75 * The subscript operator. The map can be subscripted by the
1.76 * actual keys of the graph.
1.77 */
1.78 +<<<<<<< .mine
1.79 + Reference operator[](const Key& key) {
1.80 +=======
1.81 typename Container::reference operator[](const KeyType& key) {
1.82 +>>>>>>> .r1091
1.83 int id = getGraph()->id(key);
1.84 return container[id];
1.85 }
1.86 @@ -121,7 +141,11 @@
1.87 * The const subscript operator. The map can be subscripted by the
1.88 * actual keys of the graph.
1.89 */
1.90 +<<<<<<< .mine
1.91 + ConstReference operator[](const Key& key) const {
1.92 +=======
1.93 typename Container::const_reference operator[](const KeyType& key) const {
1.94 +>>>>>>> .r1091
1.95 int id = getGraph()->id(key);
1.96 return container[id];
1.97 }
1.98 @@ -138,7 +162,7 @@
1.99 */
1.100 void add(const KeyType& key) {
1.101 int id = getGraph()->id(key);
1.102 - if (id >= container.size()) {
1.103 + if (id >= (int)container.size()) {
1.104 container.resize(id + 1);
1.105 }
1.106 }
1.107 @@ -173,7 +197,7 @@
1.108 iterator() {}
1.109
1.110 typedef extended_pair<const KeyType&, const KeyType&,
1.111 - Value&, Value&> Reference;
1.112 + Map::Reference, Map::Reference> Reference;
1.113
1.114 /** Dereference operator for map.
1.115 */
1.116 @@ -263,7 +287,7 @@
1.117 const_iterator(iterator p_it) : map(p_it.map), it(p_it.it) {}
1.118
1.119 typedef extended_pair<const KeyType&, const KeyType&,
1.120 - const Value&, const Value&> Reference;
1.121 + Map::ConstReference, Map::ConstReference> Reference;
1.122
1.123 /** Dereference operator for map.
1.124 */