src/work/deba/vector_edge_map.h
changeset 271 951cd01495e7
equal deleted inserted replaced
-1:000000000000 0:e960b9c7edc0
       
     1 #ifndef VECTOR_EDGE_MAP_H
       
     2 #define VECTOR_EDGE_MAP_H
       
     3 
       
     4 #include <vector>
       
     5 
       
     6 #include "edge_map_base.h"
       
     7 
       
     8 template <typename G, typename E, typename V> 
       
     9 class VectorEdgeMap : public EdgeMapBase<G, E>{
       
    10 public:
       
    11 	typedef V ValueType;
       
    12 	
       
    13 	VectorEdgeMap(Graph& g) : EdgeMapBase<G, E>(g) {}
       
    14 	
       
    15 	void add(const E& edge) {
       
    16 		if (edge->id >= container.size()) {
       
    17 			container.resize(edge->id);
       
    18 		}
       
    19 	}
       
    20 	
       
    21 	void erase(const E&) {}
       
    22 
       
    23 private:
       
    24 	typedef vector<ValueType> Container;
       
    25 	
       
    26 	Container container;
       
    27 }
       
    28 
       
    29 #endif