<div dir="ltr"><div><br></div>Since my graph, g, of type graph_t is:<br><div><br> typedef boost::property <boost::edge_weight_t, float > edge_properties;<br> //typedef boost::property<boost::vertex_<wbr>first_name_t, std::string> vertex_properties;<br> <br> typedef boost::property<boost::vertex_<wbr>index1_t, size_t,<br> boost::property<boost::vertex_<wbr>component_t, int> > vertex_properties;<br> <br> typedef boost::property<boost::vertex_<wbr>color_t, boost::default_color_type> color_properties;<br><br> //typedef boost::property<boost::vertex_<wbr>index1_t, size_t,<br> // boost::property<boost::vertex_<wbr>component_t, int, <br> // boost::property<boost::vertex_<wbr>color_t, boost::default_color_type>> > vertex_properties;<br><br><br>#define USE_BOOST_GRAPH_VECS<br><br> typedef boost::adjacency_list<<br>#ifdef USE_BOOST_GRAPH_VECS<br> // !NOTE: see:<a href="https://stackoverflow.com/questions/15649166/bgl-depth-first-search-error-with-color-map#15654246" target="_blank">https://stackoverflow.com/<wbr>questions/15649166/bgl-depth-<wbr>first-search-error-with-color-<wbr>map#15654246</a><br> // This is the important part of the "sea of errors".<br> // Only adjacency_list that have vecS as the VertexList <br> // template parameter have a default internal vertex_index<br> // property and this property is used by the default color <br> // map(you are using listS).<br> boost::vecS, boost::vecS,<br> //boost::vecS, boost::listS, <br> //boost::setS, boost::listS, <br>#else<br> // !Note: See <a href="http://www.boost.org/doc/libs/1_62_0/libs/graph/doc/adjacency_list.html" target="_blank">http://www.boost.org/doc/libs/<wbr>1_62_0/libs/graph/doc/<wbr>adjacency_list.html</a><br> // Iterator and Descriptor Stability/Invalidation regarding iterator stability when using<br> // the vector and list containers.<br> boost::listS, boost::listS,<br>#endif<br> boost::undirectedS,<br> //boost::bidirectionalS,<br> //boost::no_property,<br> vertex_properties,<br> edge_properties,<br> //color_properties, <br> boost::vecS<br> > graph_t;<br> graph_t g;<br><br></div><div><br></div><div>and is/was created without color properties (color_properties or vertex_color_t). When trying to create a colormap with:<br></div><div><br></div><div>property_map<graph_t, boost::vertex_color_t>::type colors = get(vertex_color_t(), g);<br></div><div><br></div><div>the error is generated by VS:<br></div><div><br></div><div>boost-1_60\boost/graph/detail/<wbr>adjacency_list.hpp(2584): error C2182: 'reference' : illegal use of type 'void'<br></div><div><br></div><div>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:<br></div><div><br></div><div>template <class PropertyTag><br>property_map<filtered_graph, PropertyTag>::type get(PropertyTag, filtered_graph& g)<br></div><div><br></div><div>Adding the property internal to the graph by commenting out:<br></div><div><br></div><div> typedef boost::property<boost::vertex_<wbr>index1_t, size_t,<br> boost::property<boost::vertex_<wbr>component_t, int> > vertex_properties;<br> <br></div><div><br></div><div>And uncommenting (putting it it place of above):<br></div><div><br> typedef boost::property<boost::vertex_<wbr>index1_t, size_t,<br> boost::property<boost::vertex_<wbr>component_t, int, <br> boost::property<boost::vertex_<wbr>color_t, boost::default_color_type>> > vertex_properties</div><br><div>The property is now internal and so a vertex colormap can be generated using:<br></div><div><br></div><div>property_map<graph_t, boost::vertex_color_t>::type colors = get(vertex_color_t(), g);</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">However an external colormap could be used:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"> typedef std::vector<int> ColorMap_t;<br> ColorMap_t colors(num_vertices(g));<br><br> vertex_color_filter_eq<<wbr>ColorMap_t> filter(colors);<br> <br> // boost::filtered_graph<graph_t, boost::keep_all, VertexPredicate><br> boost::filtered_graph<graph_t, boost::keep_all, vertex_color_filter_eq<<wbr>ColorMap_t>> fg(g, boost::keep_all(), filter);<br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Note now the successful attempt to use boost::keep_all and boost::keep_all()</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div>