No check needed when adding a new vertex, as unordered_map::insert won't do anything if key exists.

master
dmatetelki 10 years ago
parent 599b85e6c4
commit e8c071a976

@ -179,9 +179,6 @@ inline Graph<V>::Graph(std::initializer_list<Edge> edge_list)
template <typename V> template <typename V>
inline void Graph<V>::addVertex(const_reference data) inline void Graph<V>::addVertex(const_reference data)
{ {
if (m_vertices.find(data) != m_vertices.end())
return;
std::pair<V, edge_container> p(data, edge_container()); std::pair<V, edge_container> p(data, edge_container());
m_vertices.insert(p); m_vertices.insert(p);
} }

Loading…
Cancel
Save