src/work/deba/vector_edge_map.h
author marci
Thu, 08 Apr 2004 12:03:49 +0000
changeset 315 7b97540cd743
permissions -rw-r--r--
ansi pedantic bug in gcc
deba@262
     1
#ifndef VECTOR_EDGE_MAP_H
deba@262
     2
#define VECTOR_EDGE_MAP_H
deba@262
     3
deba@262
     4
#include <vector>
deba@262
     5
deba@262
     6
#include "edge_map_base.h"
deba@262
     7
deba@262
     8
template <typename G, typename E, typename V> 
deba@262
     9
class VectorEdgeMap : public EdgeMapBase<G, E>{
deba@262
    10
public:
deba@262
    11
	typedef V ValueType;
deba@262
    12
	
deba@262
    13
	VectorEdgeMap(Graph& g) : EdgeMapBase<G, E>(g) {}
deba@262
    14
	
deba@262
    15
	void add(const E& edge) {
deba@262
    16
		if (edge->id >= container.size()) {
deba@262
    17
			container.resize(edge->id);
deba@262
    18
		}
deba@262
    19
	}
deba@262
    20
	
deba@262
    21
	void erase(const E&) {}
deba@262
    22
deba@262
    23
private:
deba@262
    24
	typedef vector<ValueType> Container;
deba@262
    25
	
deba@262
    26
	Container container;
deba@262
    27
}
deba@262
    28
deba@262
    29
#endif