Open JohnCoconut opened 6 years ago
Thanks for your -as one might call it now- your thorough code review :+1:
We agree that find_first_vertex_with_name
should return an iterator, like std::find
.
I fail to see why has_vertex_with_name
should return an iterator as well. If one asks 'Does X have a Y?', the reply is expected to be 'true', 'false' (or something more human). As there is no std::has_
algorithm, which one do you refer to?
Keep up the great work!
@richelbilderbeek Sorry I wasn't clear.
I am suggesting, function has_vertex_with_name
calls find_first_vertex_with_name
. Something like this (not real code),
#include "find_first_vertex_with_name.hpp"
bool has_vertex_with_name(const Name& name, const Graph& g)
{
auto vip = vertices(g);
auto iter = find_first_vertex_with_name(name, g);
return iter != vip.second;
}
Totally agree! I'd enjoy getting rid if the code duplication in this repo.
(just checked Travis, still fails :disappointed:)
The return value of these two algorithms should be an iterator
iter
to vertices of graph.Use
iter != vip.second
to checkhas_vertex_with_name
.And dereference it to get vertex descriptor.
It's consistent with STL algorithm in this way.