src/hugo/vector_map.h
changeset 897 ef09eee53b09
parent 891 74589d20dbc3
child 901 69a8e672acb1
equal deleted inserted replaced
3:c601d2eae044 4:7a81433f05f0
    67     /// The const reference type of the map;
    67     /// The const reference type of the map;
    68     typedef typename Container::const_reference ConstReferenceType;
    68     typedef typename Container::const_reference ConstReferenceType;
    69     /// The pointer type of the map;
    69     /// The pointer type of the map;
    70     typedef typename Container::const_pointer ConstPointerType;
    70     typedef typename Container::const_pointer ConstPointerType;
    71 
    71 
    72     /** Default constructor for the map.
       
    73      */
       
    74     VectorMap() {}
       
    75 		
       
    76     /** Graph and Registry initialized map constructor.
    72     /** Graph and Registry initialized map constructor.
    77      */
    73      */
    78     VectorMap(const Graph& g, MapRegistry& r) 
    74     VectorMap(const Graph& g, MapRegistry& r) 
    79       : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1) {}
    75       : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1) {}
    80 
    76 
    96 
    92 
    97     /** Assign operator to copy a map of an other map type.
    93     /** Assign operator to copy a map of an other map type.
    98      */
    94      */
    99     template <typename TT>
    95     template <typename TT>
   100     VectorMap& operator=(const VectorMap<MapRegistry, TT>& c) {
    96     VectorMap& operator=(const VectorMap<MapRegistry, TT>& c) {
   101       container.resize(c.container.size());
    97       if (MapBase::getGraph() != c.getGraph()) {
   102       MapBase::operator=(c);
    98 	MapBase::operator=(c);
       
    99 	container.resize(c.container.size());
       
   100       }
   103       for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
   101       for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
   104 	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
   102 	int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it);
   105 	container[id] = c.container[id];
   103 	container[id] = c.container[id];
   106       }
   104       }
   107       return *this;
   105       return *this;