When using a boost::vecS for VertexList in the adjacency_list boost::depth_first_search(Graph, Visitor) compiles and works correctly. When switching the VertexList type to boost::listS I receive the compiler error:
boost_1_65_0\boost\graph\detail\adjacency_list.hpp(2545): error C2182: 'const_reference': illegal use of type 'void
From this error I would gather that the boost::listS is not a valid type, however the BOOST CONCEPT checks pass.
If boost::listS is not a valid type for depth_first_search, why?
Below is example code demonstrating the issue. Switching from vecS to listS generates the above error. I am using Visual Studio 2017 and boost 1.65.0
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/depth_first_search.hpp>
#include <boost/graph/graph_concepts.hpp>
//typedef boost::adjacency_list<boost::listS, boost::listS, boost::bidirectionalS> MyGraph;
typedef boost::adjacency_list<boost::listS, boost::vecS, boost::bidirectionalS> MyGraph;
using VertexType = boost::graph_traits<MyGraph>::vertex_descriptor;
BOOST_CONCEPT_ASSERT((boost::VertexListGraphConcept<MyGraph>));
BOOST_CONCEPT_ASSERT((boost::IncidenceGraphConcept<MyGraph>));
class dfs_visitor : public boost::default_dfs_visitor
{
public:
void discover_vertex(VertexType u, const MyGraph& g) const
{
}
void finish_vertex(VertexType u, const MyGraph& g) const
{
}
};
BOOST_CONCEPT_ASSERT((boost::DFSVisitorConcept<dfs_visitor, MyGraph>));
int main()
{
MyGraph g;
dfs_visitor vis;
boost::depth_first_search(g, boost::visitor(vis));
return 0;
}