author | athos |
Fri, 02 Apr 2004 15:59:17 +0000 | |
changeset 277 | 044f5898b769 |
permissions | -rw-r--r-- |
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 |