Index: src/hugo/Makefile.am
===================================================================
--- src/hugo/Makefile.am	(revision 843)
+++ src/hugo/Makefile.am	(revision 844)
@@ -18,4 +18,5 @@
 	map_iterator.h                                                  \
 	map_registry.h                                                  \
+	map_bits.h							\
 	maps.h								\
 	mincostflows.h                                                  \
Index: src/hugo/array_map.h
===================================================================
--- src/hugo/array_map.h	(revision 830)
+++ src/hugo/array_map.h	(revision 844)
@@ -6,4 +6,5 @@
 
 #include <hugo/map_iterator.h>
+#include <hugo/map_bits.h>
 
 ///\ingroup graphmaps
@@ -72,5 +73,5 @@
       allocate_memory();
       for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = MapBase::getGraph()->id(it);
+	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
 	allocator.construct(&(values[id]), Value());
       }								
@@ -83,5 +84,5 @@
       allocate_memory();
       for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = MapBase::getGraph()->id(it);
+	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
 	allocator.construct(&(values[id]), v);
       }								
@@ -95,5 +96,5 @@
       values = allocator.allocate(capacity);
       for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = MapBase::getGraph()->id(it);
+	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
 	allocator.construct(&(values[id]), copy.values[id]);
       }
@@ -124,5 +125,5 @@
       values = allocator.allocate(capacity);
       for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = MapBase::getGraph()->id(it);
+	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
 	allocator.construct(&(values[id]), copy.values[id]);
       }
@@ -133,7 +134,8 @@
      */
     template <typename CMap> ArrayMap& operator=(const CMap& copy) {
-      if (MapBase::getGraph()) {
+      if (capacity != 0) {
 	MapBase::destroy();
-      } 
+	allocator.deallocate(values, capacity);
+      }
       MapBase::operator=(copy);
       if (MapBase::getGraph()) {
@@ -161,5 +163,5 @@
      */
     ReferenceType operator[](const KeyType& key) {
-      int id = MapBase::getGraph()->id(key);
+      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
       return values[id];
     } 
@@ -170,5 +172,5 @@
      */
     ConstReferenceType operator[](const KeyType& key) const {
-      int id = MapBase::getGraph()->id(key);
+      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
       return values[id];
     }
@@ -178,5 +180,5 @@
      */
     void set(const KeyType& key, const ValueType& val) {
-      int id = MapBase::getGraph()->id(key);
+      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
       values[id] = val;
     }
@@ -185,5 +187,5 @@
      */
     void add(const KeyType& key) {
-      int id = MapBase::getGraph()->id(key);
+      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
       if (id >= capacity) {
 	int new_capacity = (capacity == 0 ? 1 : capacity);
@@ -193,5 +195,5 @@
 	Value* new_values = allocator.allocate(new_capacity);;
 	for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	  int jd = MapBase::getGraph()->id(it);
+	  int jd = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
 	  if (id != jd) {
 	    allocator.construct(&(new_values[jd]), values[jd]);
@@ -209,5 +211,5 @@
      */
     void erase(const KeyType& key) {
-      int id = MapBase::getGraph()->id(key);
+      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
       allocator.destroy(&(values[id]));
     }
@@ -279,11 +281,5 @@
       
     void allocate_memory() {
-      int max_id = -1;
-      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	int id = MapBase::getGraph()->id(it);
-	if (id > max_id) {
-	  max_id = id;
-	}			
-      }
+      int max_id = KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph());
       if (max_id == -1) {
 	capacity = 0;
@@ -301,4 +297,17 @@
     Value* values;
     Allocator allocator;
+
+  public:
+    // STL  compatibility typedefs.
+    typedef Iterator iterator;
+    typedef ConstIterator const_iterator;
+    typedef typename Iterator::PairValueType value_type;
+    typedef typename Iterator::KeyType key_type;
+    typedef typename Iterator::ValueType data_type;
+    typedef typename Iterator::PairReferenceType reference;
+    typedef typename Iterator::PairPointerType pointer;
+    typedef typename ConstIterator::PairReferenceType const_reference;
+    typedef typename ConstIterator::PairPointerType const_pointer;
+    typedef int difference_type;		
   };		
 
Index: src/hugo/graph_wrapper.h
===================================================================
--- src/hugo/graph_wrapper.h	(revision 838)
+++ src/hugo/graph_wrapper.h	(revision 844)
@@ -1389,5 +1389,5 @@
     void erase(const Edge& e) const {
       Node n=tail(e);
-      typename Graph::OutEdgeIt f(*graph, n);
+      typename Graph::OutEdgeIt f(*Parent::graph, n);
       ++f;
       first_out_edges->set(n, f);
Index: src/hugo/list_graph.h
===================================================================
--- src/hugo/list_graph.h	(revision 827)
+++ src/hugo/list_graph.h	(revision 844)
@@ -1115,5 +1115,8 @@
       OutEdgeIt(const EdgeSet& _G,const Node v) :
 	Edge(_G.nodes[v].first_out), G(&_G) { }
-      OutEdgeIt &operator++() { n = G->edges[n].next_out; return *this; }
+      OutEdgeIt &operator++() { 
+	Edge::n = G->edges[Edge::n].next_out;
+	return *this; 
+      }
     };
     
@@ -1127,5 +1130,8 @@
       InEdgeIt(const EdgeSet& _G,Node v)
 	: Edge(_G.nodes[v].first_in), G(&_G) { }
-      InEdgeIt &operator++() { n=G->edges[n].next_in; return *this; }
+      InEdgeIt &operator++() { 
+	Edge::n = G->edges[Edge::n].next_in; 
+	return *this; 
+      }
     };
     
Index: src/hugo/map_bits.h
===================================================================
--- src/hugo/map_bits.h	(revision 844)
+++ src/hugo/map_bits.h	(revision 844)
@@ -0,0 +1,52 @@
+// -*- c++ -*- 
+#ifndef MAP_BITS_H
+#define MAP_BITS_H
+
+///\ingroup graphmaps
+///\file
+///\brief Some utils to help implement maps.
+
+namespace hugo {
+
+
+  /// \addtogroup graphmaps
+  /// @{
+
+  /// Helper class to get information about the key type.
+  template <typename Graph, typename KeyIt>
+  struct KeyInfo {};
+
+  template <typename Graph>
+  struct KeyInfo<Graph, typename Graph::NodeIt> {
+    static int maxId(const Graph& graph) {
+      return graph.maxNodeId();
+    }
+    static int id(const Graph& graph, const typename Graph::Node& node) {
+      return graph.id(node);
+    }
+  };
+
+  template <typename Graph>
+  struct KeyInfo<Graph, typename Graph::EdgeIt> {
+    static int maxId(const Graph& graph) {
+      return graph.maxEdgeId();
+    }
+    static int id(const Graph& graph, const typename Graph::Edge& edge) {
+      return graph.id(edge);
+    }
+  };
+
+  template <typename Graph>
+  struct KeyInfo<Graph, typename Graph::SymEdgeIt> {
+    static int maxId(const Graph& graph) {
+      return graph.maxEdgeId() >> 1;
+    }
+    static int id(const Graph& graph, const typename Graph::Edge& edge) {
+      return graph.id(edge) >> 1;
+    }
+  };
+
+  /// @}
+}
+
+#endif
Index: src/hugo/map_defines.h
===================================================================
--- src/hugo/map_defines.h	(revision 822)
+++ src/hugo/map_defines.h	(revision 844)
@@ -97,5 +97,5 @@
 typedef SymEdgeIt<Graph, Edge, EdgeIt> SymEdgeIt; \
 typedef MapRegistry<Graph, Edge, SymEdgeIt> SymEdgeMapRegistry; \
-mutable EdgeMapRegistry sym_edge_maps;
+mutable SymEdgeMapRegistry sym_edge_maps;
 
 
Index: src/hugo/map_iterator.h
===================================================================
--- src/hugo/map_iterator.h	(revision 830)
+++ src/hugo/map_iterator.h	(revision 844)
@@ -2,4 +2,6 @@
 #ifndef MAP_ITERATOR_H
 #define MAP_ITERATOR_H
+
+#include <iterator>
 
 #include <hugo/extended_pair.h>
@@ -23,4 +25,5 @@
 
   public:
+
     /// The key type of the iterator.
     typedef typename Map::KeyType KeyType;
@@ -80,5 +83,9 @@
     friend class MapConstIterator<Map>;
 
-  public:
+
+  public:
+
+    /// The iterator base class.
+    typedef MapIteratorBase<Map> Base;
 
     /// The key type of the iterator.
@@ -102,4 +109,8 @@
     
   public:
+
+    /// The value type of the iterator.
+    typedef extended_pair<KeyType, const KeyType&,
+      ValueType, const ValueType&> PairValueType;
 
     /// The reference type of the iterator. 
@@ -112,10 +123,9 @@
     /// Constructor to initalize the iterators returned 
     /// by the begin() and end().
-    MapIterator(Map& pmap, const KeyIt& pit) 
-      : MapIteratorBase<Map>(pit), map(&pmap) {}
+    MapIterator(Map& pmap, const KeyIt& pit) : Base(pit), map(&pmap) {}
 
     /// Dereference operator for the iterator.
     PairReferenceType operator*() {
-      return PairReferenceType(it, (*map)[it]);
+      return PairReferenceType(Base::it, (*map)[Base::it]);
     }
 
@@ -133,10 +143,10 @@
     /// Arrow operator for the iterator.
     PairPointerType operator->() {
-      return PairPointerType(it, ((*map)[it])); 
+      return PairPointerType(Base::it, ((*map)[Base::it])); 
     }
 	
     /// The pre increment operator of the iterator.
     MapIterator& operator++() { 
-      increment(); 
+      Base::increment(); 
       return *this; 
     }
@@ -144,6 +154,6 @@
     /// The post increment operator of the iterator.
     MapIterator operator++(int) { 
-      MapIterator tmp(it); 
-      increment(); 
+      MapIterator tmp(*this); 
+      Base::increment(); 
       return tmp; 
     }
@@ -151,4 +161,12 @@
   private:
     Map* map;
+
+  public:
+    // STL  compatibility typedefs.
+    typedef std::forward_iterator_tag iterator_category;
+    typedef int difference_type;
+    typedef PairValueType value_type;
+    typedef PairReferenceType reference;
+    typedef PairPointerType pointer;
   };
 
@@ -160,4 +178,7 @@
     
   public:
+
+    /// The iterator base class.
+    typedef MapIteratorBase<Map> Base;
 
     /// The key type of the iterator.
@@ -188,11 +209,15 @@
     ///  by the begin() and end().
     MapConstIterator(const Map& pmap, const KeyIt& pit) 
-      : MapIteratorBase<Map>(pit), map(&pmap) {}
+      : Base(pit), map(&pmap) {}
 
     /// Constructor to create const iterator from a non const.
     MapConstIterator(const MapIterator<Map>& pit) {
-      it = pit.it;
+      Base::it = pit.Base::it;
       map = pit.map;
     }
+
+    /// The value type of the iterator.
+    typedef extended_pair<KeyType, const KeyType&,
+      ValueType, const ValueType&> PairValueType;
 
     /// The reference type of map.
@@ -202,5 +227,5 @@
     /// Dereference operator for the iterator.
     PairReferenceType operator*() {
-      return PairReferenceType(it, (*map)[it]);
+      return PairReferenceType(Base::it, (*map)[Base::it]);
     }
 
@@ -218,10 +243,10 @@
     /// Arrow operator for the iterator.
     PairPointerType operator->() {
-      return PairPointerType(it, ((*map)[it])); 
+      return PairPointerType(Base::it, (*map)[Base::it]); 
     }
 
     /// The pre increment operator of the iterator.
     MapConstIterator& operator++() { 
-      increment(); 
+      Base::increment(); 
       return *this; 
     }
@@ -229,6 +254,6 @@
     /// The post increment operator of the iterator.
     MapConstIterator operator++(int) { 
-      MapConstIterator<Map> tmp(it); 
-      increment(); 
+      MapConstIterator tmp(*this); 
+      Base::increment(); 
       return tmp; 
     }
@@ -236,4 +261,12 @@
   private:
     const Map* map;
+
+  public:
+    // STL  compatibility typedefs.
+    typedef std::input_iterator_tag iterator_category;
+    typedef int difference_type;
+    typedef PairValueType value_type;
+    typedef PairReferenceType reference;
+    typedef PairPointerType pointer;
   };
 
@@ -246,4 +279,7 @@
   public:
 
+    /// The iterator base class.
+    typedef MapIteratorBase<Map> Base;
+ 
     /// The key type of the iterator.
     typedef typename Map::KeyType KeyType;
@@ -257,9 +293,9 @@
 
     /// KeyIt initialized iterator.
-    MapKeyIterator(const KeyIt& pit) : MapIteratorBase<Map>(pit) {}
+    MapKeyIterator(const KeyIt& pit) : Base(pit) {}
 
     /// The pre increment operator of the iterator.
     MapKeyIterator& operator++() {
-      increment(); 
+      Base::increment(); 
       return *this; 
     }
@@ -268,5 +304,5 @@
     MapKeyIterator operator++(int) {
       MapKeyIterator tmp(*this);
-      increment();
+      Base::increment();
       return tmp;
     }
@@ -274,10 +310,21 @@
     /// The dereferencing operator of the iterator.
     KeyType operator*() const {
-      return static_cast<KeyType>(it);
-    }
+      return static_cast<KeyType>(Base::it);
+    }
+
+  public:
+    // STL  compatibility typedefs.
+    typedef std::input_iterator_tag iterator_category;
+    typedef int difference_type;
+    typedef KeyType value_type;
+    typedef const KeyType& reference;
+    typedef const KeyType* pointer;
   };
 
   template <typename Map> class MapConstValueIterator;
 
+  /** MapValueIterator creates an stl compatible iterator
+   *  for the values.
+   */
   template <typename Map>
   class MapValueIterator : public MapIteratorBase<Map> {
@@ -286,4 +333,7 @@
 
   public:
+
+    /// The iterator base class.
+    typedef MapIteratorBase<Map> Base;
 
     /// The key type of the iterator.
@@ -318,10 +368,10 @@
     /// Map and KeyIt initialized iterator.
     MapValueIterator(Map& pmap, const KeyIt& pit) 
-      : MapIteratorBase<Map>(pit), map(&pmap) {}
+      : Base(pit), map(&pmap) {}
     
 
     /// The pre increment operator of the iterator.
     MapValueIterator& operator++() {
-      increment(); 
+      Base::increment(); 
       return *this; 
     }
@@ -330,5 +380,5 @@
     MapValueIterator operator++(int) {
       MapValueIterator tmp(*this);
-      increment();
+      Base::increment();
       return tmp;
     }
@@ -336,5 +386,5 @@
     /// The dereferencing operator of the iterator.
     ReferenceType operator*() const {
-      return (*map)[it];
+      return (*map)[Base::it];
     }
 
@@ -344,6 +394,16 @@
     }
 
-  };
-
+  public:
+    // STL  compatibility typedefs.
+    typedef std::forward_iterator_tag iterator_category;
+    typedef int difference_type;
+    typedef ValueType value_type;
+    typedef ReferenceType reference;
+    typedef PointerType pointer;
+  };
+
+  /** MapValueIterator creates an stl compatible iterator
+   *  for the const values.
+   */
 
   template <typename Map>
@@ -352,9 +412,11 @@
   public:
 
-    /// The key type of the iterator.
-    typedef typename Map::KeyType KeyType;
-    /// The iterator to iterate on the keys.
-    typedef typename Map::KeyIt KeyIt;
-
+    /// The iterator base class.
+    typedef MapIteratorBase<Map> Base;
+
+    /// The key type of the iterator.
+    typedef typename Map::KeyType KeyType;
+    /// The iterator to iterate on the keys.
+    typedef typename Map::KeyIt KeyIt;
 
     /// The value type of the iterator.
@@ -383,5 +445,5 @@
     /// Constructor to create const iterator from a non const.
     MapConstValueIterator(const MapValueIterator<Map>& pit) {
-      it = pit.it;
+      Base::it = pit.Base::it;
       map = pit.map;
     }
@@ -389,9 +451,9 @@
     /// Map and KeyIt initialized iterator.
     MapConstValueIterator(const Map& pmap, const KeyIt& pit) 
-      : MapIteratorBase<Map>(pit), map(&pmap) {}
+      : Base(pit), map(&pmap) {}
 
     /// The pre increment operator of the iterator.
     MapConstValueIterator& operator++() {
-      increment(); 
+      Base::increment(); 
       return *this; 
     }
@@ -400,5 +462,5 @@
     MapConstValueIterator operator++(int) {
       MapConstValueIterator tmp(*this);
-      increment();
+      Base::increment();
       return tmp;
     }
@@ -406,5 +468,5 @@
     /// The dereferencing operator of the iterator.
     ConstReferenceType operator*() const {
-      return (*map)[it];
+      return (*map)[Base::it];
     }
 
@@ -414,4 +476,11 @@
     }
 
+  public:
+    // STL  compatibility typedefs.
+    typedef std::input_iterator_tag iterator_category;
+    typedef int difference_type;
+    typedef ValueType value_type;
+    typedef ConstReferenceType reference;
+    typedef ConstPointerType pointer;
   };
 
@@ -431,4 +500,19 @@
     /// The iterator to iterate on the keys.
     typedef typename Map::KeyIt KeyIt;
+
+
+    /// The value type of the iterator.
+    typedef typename Map::ValueType ValueType;
+    /// The reference type of the iterator.
+    typedef typename Map::ReferenceType ReferenceType;
+    /// The pointer type of the iterator.
+    typedef typename Map::PointerType PointerType;
+
+    /// The const value type of the iterator.
+    typedef typename Map::ConstValueType ConstValueType;
+    /// The const reference type of the iterator.
+    typedef typename Map::ConstReferenceType ConstReferenceType;
+    /// The pointer type of the iterator.
+    typedef typename Map::ConstPointerType ConstPointerType;
 
     /// The map initialized const key set.
@@ -447,4 +531,12 @@
       return ConstIterator(KeyIt(INVALID));
     }
+ 
+  public:
+    // STL  compatibility typedefs.
+    typedef ValueType value_type;
+    typedef ConstIterator const_iterator;
+    typedef ConstReferenceType const_reference;
+    typedef ConstPointerType const_pointer;
+    typedef int difference_type;
   };
 
@@ -465,4 +557,19 @@
     typedef typename Map::KeyIt KeyIt;
 
+
+    /// The value type of the iterator.
+    typedef typename Map::ValueType ValueType;
+    /// The reference type of the iterator.
+    typedef typename Map::ReferenceType ReferenceType;
+    /// The pointer type of the iterator.
+    typedef typename Map::PointerType PointerType;
+
+    /// The const value type of the iterator.
+    typedef typename Map::ConstValueType ConstValueType;
+    /// The const reference type of the iterator.
+    typedef typename Map::ConstReferenceType ConstReferenceType;
+    /// The pointer type of the iterator.
+    typedef typename Map::ConstPointerType ConstPointerType;
+
     /// The map initialized const value set.
     MapConstValueSet(const Map& pmap) : map(&pmap) {}
@@ -480,4 +587,12 @@
       return ConstIterator(*map, KeyIt(INVALID));
     }
+
+  public:
+    // STL  compatibility typedefs.
+    typedef ValueType value_type;
+    typedef ConstIterator const_iterator;
+    typedef ConstReferenceType const_reference;
+    typedef ConstPointerType const_pointer;
+    typedef int difference_type;
   };
 
@@ -499,4 +614,19 @@
     typedef typename Map::KeyIt KeyIt;
 
+
+    /// The value type of the iterator.
+    typedef typename Map::ValueType ValueType;
+    /// The reference type of the iterator.
+    typedef typename Map::ReferenceType ReferenceType;
+    /// The pointer type of the iterator.
+    typedef typename Map::PointerType PointerType;
+
+    /// The const value type of the iterator.
+    typedef typename Map::ConstValueType ConstValueType;
+    /// The const reference type of the iterator.
+    typedef typename Map::ConstReferenceType ConstReferenceType;
+    /// The pointer type of the iterator.
+    typedef typename Map::ConstPointerType ConstPointerType;
+
     /// The map initialized value set.
     MapValueSet(Map& pmap) : map(&pmap) {}
@@ -528,4 +658,15 @@
     }
             
+  public:
+    // STL  compatibility typedefs.
+    typedef ValueType value_type;
+    typedef Iterator iterator;
+    typedef ConstIterator const_iterator;
+    typedef ReferenceType reference;
+    typedef ConstReferenceType const_reference;
+    typedef PointerType pointer;
+    typedef ConstPointerType const_pointer;
+    typedef int difference_type;
+
   };
 
Index: src/hugo/sym_map.h
===================================================================
--- src/hugo/sym_map.h	(revision 822)
+++ src/hugo/sym_map.h	(revision 844)
@@ -18,4 +18,5 @@
    */
 
+
   template <typename Graph, typename Edge, typename EdgeIt>
   class SymEdgeIt : public EdgeIt {
@@ -31,5 +32,5 @@
     SymEdgeIt(const Graph& graph) 
       : EdgeIt(graph) {
-      while ( (n & 1) && n != -1) {
+      while ( (EdgeIt::n & 1) && EdgeIt::n != -1) {
 	EdgeIt::operator++();
       }
@@ -45,5 +46,5 @@
     SymEdgeIt(const Graph& graph, const Edge& edge)
       : EdgeIt(graph, edge) {
-      while ( (n & 1) && n != -1) {
+      while ( (EdgeIt::n & 1) && EdgeIt::n != -1) {
 	EdgeIt::operator++();
       }
@@ -54,5 +55,5 @@
     SymEdgeIt& operator++() {
       EdgeIt::operator++();
-      while ( (n & 1) && n != -1) {
+      while ( (EdgeIt::n & 1) && EdgeIt::n != -1) {
 	EdgeIt::operator++();
       }
@@ -122,30 +123,4 @@
     }
    
-    /**
-     * The subscript operator. The map can be subscripted by the
-     * actual keys of the graph. 
-     */
-    typename MapImpl::ReferenceType operator[](const KeyType& key) {
-      int id = MapImpl::getGraph()->id(key);	
-      return MapImpl::operator[](id >> 1);
-    } 
-		
-    /**
-     * The const subscript operator. The map can be subscripted by the
-     * actual keys of the graph. 
-     */
-    typename MapImpl::ConstReferenceType operator[](const KeyType& key) const {
-      int id = MapImpl::getGraph()->id(key);
-      return MapImpl::operator[](id >> 1);
-    }
-	
-    /** Setter function of the map. Equivalent with map[key] = val.
-     *  This is a compatibility feature with the not dereferable maps.
-     */
-    void set(const KeyType& key, const typename MapImpl::ValueType& val) {
-      int id = MapImpl::getGraph()->id(key);
-      MapImpl::operator[](id >> 1) = val;
-    }
-		
     /** Add a new key to the map. It called by the map registry.
      */
Index: src/hugo/vector_map.h
===================================================================
--- src/hugo/vector_map.h	(revision 830)
+++ src/hugo/vector_map.h	(revision 844)
@@ -6,4 +6,5 @@
 
 #include <hugo/map_iterator.h>
+#include <hugo/map_bits.h>
 
 ///\ingroup graphmaps
@@ -74,30 +75,18 @@
     /** Graph and Registry initialized map constructor.
      */
-    VectorMap(const Graph& g, MapRegistry& r) : MapBase(g, r) {
-      init();
-    }
+    VectorMap(const Graph& g, MapRegistry& r) 
+      : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1) {}
 
     /** Constructor to use default value to initialize the map. 
      */
     VectorMap(const Graph& g, MapRegistry& r, const Value& v) 
-      : MapBase(g, r) {
-      for (KeyIt it(*getGraph()); it != INVALID; ++it) {
-	int id = getGraph()->id(it);
-	if (id >= (int)container.size()) {
-	  container.resize(id + 1);
-	}
-	set(it, v);
-      }
-    }
+      : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1, v) {}
 
     /** Constructor to copy a map of an other map type.
      */
     template <typename CMap> VectorMap(const CMap& copy) : MapBase(copy) {
-      if (getGraph()) {
-	for (KeyIt it(*getGraph()); it != INVALID; ++it) {
-	  int id = getGraph()->id(it);
-	  if (id >= (int)container.size()) {
-	    container.resize(id + 1);
-	  }
+      if (MapBase::getGraph()) {
+	container.resize(KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph())+1);
+	for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
 	  set(it, copy[it]);
 	}
@@ -108,14 +97,9 @@
      */
     template <typename CMap> VectorMap& operator=(const CMap& copy) {
-      if (getGraph()) {
-	destroy();
-      } 
+      container.clear();
       this->MapBase::operator=(copy);
-      if (getGraph()) {
-	for (KeyIt it(*getGraph()); it != INVALID; ++it) {
-	  int id = getGraph()->id(it);
-	  if (id >= (int)container.size()) {
-	    container.resize(id + 1);
-	  }
+      if (MapBase::getGraph()) {
+	container.resize(KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph())+1);
+	for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
 	  set(it, copy[it]);
 	}
@@ -134,5 +118,5 @@
      */
     ReferenceType operator[](const KeyType& key) {
-      int id = getGraph()->id(key);
+      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
       return container[id];
     } 
@@ -143,5 +127,5 @@
      */
     ConstReferenceType operator[](const KeyType& key) const {
-      int id = getGraph()->id(key);
+      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
       return container[id];
     }
@@ -151,5 +135,5 @@
      */
     void set(const KeyType& key, const ValueType& val) {
-      int id = getGraph()->id(key);
+      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
       container[id] = val;
     }
@@ -158,5 +142,5 @@
      */
     void add(const KeyType& key) {
-      int id = getGraph()->id(key);
+      int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), key);
       if (id >= (int)container.size()) {
 	container.resize(id + 1);
@@ -232,5 +216,16 @@
     Container container;
 
-		
+  public:
+    // STL  compatibility typedefs.
+    typedef Iterator iterator;
+    typedef ConstIterator const_iterator;
+    typedef typename Iterator::PairValueType value_type;
+    typedef typename Iterator::KeyType key_type;
+    typedef typename Iterator::ValueType data_type;
+    typedef typename Iterator::PairReferenceType reference;
+    typedef typename Iterator::PairPointerType pointer;
+    typedef typename ConstIterator::PairReferenceType const_reference;
+    typedef typename ConstIterator::PairPointerType const_pointer;
+    typedef int difference_type;		
   };
   
Index: src/test/test_tools.h
===================================================================
--- src/test/test_tools.h	(revision 825)
+++ src/test/test_tools.h	(revision 844)
@@ -1,2 +1,3 @@
+// -*- c++ -*-
 #ifndef HUGO_TEST_TEST_TOOLS_H
 #define HUGO_TEST_TEST_TOOLS_H
