Since my graph, g, of type graph_t is:
typedef boost::property edge_properties;
//typedef boost::property
vertex_properties;
typedef boost::property > vertex_properties;
typedef boost::property color_properties;
//typedef boost::property> > vertex_properties;
#define USE_BOOST_GRAPH_VECS
typedef boost::adjacency_list<
#ifdef USE_BOOST_GRAPH_VECS
// !NOTE: see:https://stackoverflow.com/
questions/15649166/bgl-depth-first-search-error-with-color-map#15654246
// This is the important part of the "sea of errors".
// Only adjacency_list that have vecS as the VertexList
// template parameter have a default internal vertex_index
// property and this property is used by the default color
// map(you are using listS).
boost::vecS, boost::vecS,
//boost::vecS, boost::listS,
//boost::setS, boost::listS,
#else
// !Note: See http://www.boost.org/doc/libs/1_62_0/libs/graph/doc/
adjacency_list.html
// Iterator and Descriptor Stability/Invalidation regarding
iterator stability when using
// the vector and list containers.
boost::listS, boost::listS,
#endif
boost::undirectedS,
//boost::bidirectionalS,
//boost::no_property,
vertex_properties,
edge_properties,
//color_properties,
boost::vecS
> graph_t;
graph_t g;
and is/was created without color properties (color_properties or
vertex_color_t). When trying to create a colormap with:
property_map::type colors =
get(vertex_color_t(), g);
the error is generated by VS:
boost-1_60\boost/graph/detail/adjacency_list.hpp(2584): error C2182:
'reference' : illegal use of type 'void'
which is ofcourse not real clear what is generating the error but after
finding the actual offending line 5 lines later in the error console as is
the power of template meta programing. The "illegal use of type 'void'"
error is a result of the graph not having an internal property that can be
accessed by get:
template <class PropertyTag>
property_map::type get(PropertyTag,
filtered_graph& g)
Adding the property internal to the graph by commenting out:
typedef boost::property > vertex_properties;
And uncommenting (putting it it place of above):
typedef boost::property> > vertex_properties
The property is now internal and so a vertex colormap can be generated
using:
property_map::type colors =
get(vertex_color_t(), g);
However an external colormap could be used:
typedef std::vector<int> ColorMap_t;
ColorMap_t colors(num_vertices(g));
vertex_color_filter_eq filter(colors);
// boost::filtered_graph
boost::filtered_graph>
fg(g, boost::keep_all(), filter);
Note now the successful attempt to use boost::keep_all and boost::keep_all()