| 139 | } |
| 140 | |
| 141 | void NamedObjectVector::DeleteObj(const std::string &name) { |
| 142 | const u_int index = GetIndex(name); |
| 143 | objs.erase(objs.begin() + index); |
| 144 | |
| 145 | // I have to rebuild the indices from scratch |
| 146 | name2index.clear(); |
| 147 | index2obj.clear(); |
| 148 | |
| 149 | for (u_int i = 0; i < objs.size(); ++i) { |
| 150 | NamedObject *obj = objs[i]; |
| 151 | |
| 152 | name2index.insert(Name2IndexType::value_type(obj->GetName(), i)); |
| 153 | index2obj.insert(Index2ObjType::value_type(i, obj)); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | template<class MapType> void PrintMap(const MapType &map, std::ostream &os) { |
| 158 | typedef typename MapType::const_iterator const_iterator; |
no test coverage detected