graph-v2
graph-v2 copied to clipboard
Incorrect usage of concept `_common_vertex_range`
There is something wrong with every usage of concept _common_vertex_range, for instance:
https://github.com/stdgraph/graph-v2/blob/master/include/graph/graph.hpp#L124
We have
template <class G>
concept _common_vertex_range = sized_range<vertex_range_t<G>> &&
requires(G&& g, vertex_iterator_t<G> ui) { vertex_id(g, ui); };
template <class G>
concept vertex_range = _common_vertex_range<vertex_range_t<G>> &&
forward_range<vertex_range_t<G>>;
The problem is that in the definition of vertex_range we extract the range-of-vertices type from G via vertex_range_t<G> and pass this to _common_vertex_range. That is, what is passed to _common_vertex_range is not G but the range-of-vertices. However, the definition of _common_vertex_range assumes that the passed type G is the graph type rather than range-of-vertices and applies vertex_range_t<G> again.
It is only by accident that it works for some tested cases.