Changeset 891:74589d20dbc3 in lemon-0.x for src/hugo/vector_map.h
- Timestamp:
- 09/21/04 00:57:48 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1199
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/hugo/vector_map.h
r844 r891 33 33 template <typename MapRegistry, typename Value> 34 34 class VectorMap : public MapRegistry::MapBase { 35 template <typename MR, typename T> friend class VectorMap; 35 36 public: 36 37 … … 83 84 : MapBase(g, r), container(KeyInfo<Graph, KeyIt>::maxId(g)+1, v) {} 84 85 85 /** Constructor to copy a map of an other map type.86 */ 87 template <typename CMap> VectorMap(const CMap& copy) : MapBase(copy) {88 if (MapBase::getGraph()) {89 container.resize(KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph())+1); 90 91 set(it, copy[it]);92 }86 /** Assign operator to copy a map of an other map type. 87 */ 88 template <typename TT> 89 VectorMap(const VectorMap<MapRegistry, TT>& c) 90 : MapBase(c), container(c.container.size()) { 91 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 92 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 93 container[id] = c.container[id]; 93 94 } 94 95 } 95 96 96 /** Assign operator to copy a map an other map type. 97 */ 98 template <typename CMap> VectorMap& operator=(const CMap& copy) { 99 container.clear(); 100 this->MapBase::operator=(copy); 101 if (MapBase::getGraph()) { 102 container.resize(KeyInfo<Graph, KeyIt>::maxId(*MapBase::getGraph())+1); 103 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 104 set(it, copy[it]); 105 } 97 /** Assign operator to copy a map of an other map type. 98 */ 99 template <typename TT> 100 VectorMap& operator=(const VectorMap<MapRegistry, TT>& c) { 101 container.resize(c.container.size()); 102 MapBase::operator=(c); 103 for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) { 104 int id = KeyInfo<Graph, KeyIt>::id(*MapBase::getGraph(), it); 105 container[id] = c.container[id]; 106 106 } 107 107 return *this; 108 108 } 109 110 /** The destructor of the map.111 */112 virtual ~VectorMap() {113 }114 115 109 /** 116 110 * The subscript operator. The map can be subscripted by the
Note: See TracChangeset
for help on using the changeset viewer.