Opened 6 years ago

#12939 new Bugs

use of boost::graph_bundle with subgraph

Reported by: ioannis.nousias@… Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost 1.60.0 Severity: Problem
Keywords: subgraph, graph_bundle Cc: ioannis.nousias@…

Description

using boost::graph_bundle with a subgraph picks up the 'vertex' access delegate. This is because boost::graph_bundle enumeration gets downgraded to an integer, which matches the first template specialization in subgraph.hpp

example:

struct VertexProperties { std::string name; };
struct EdgeProperties { std::string name; };
struct GraphProperties { std::string name; };

boost::subgraph< boost::adjacency_list<
	boost::vecS,
	boost::vecS,
	boost::bidirectionalS,
	boost::property<boost::vertex_index_t,size_t,VertexProperties>,
	boost::property<boost::edge_index_t,size_t,EdgeProperties>,
	GraphProperties>
> graph;

auto name = graph[boost::graph_bundle].name;

compiler error:

boost/graph/subgraph.hpp:278:24: error: no match for ternary 'operator?:' (operand types are 'bool', 'boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, boost::property<boost::vertex_index_t, long unsigned int, tpg::VertexProperties>, boost::property<boost::edge_index_t, long unsigned int, tpg::EdgeProperties>, tpg::GraphProperties>::graph_bundled {aka tpg::GraphProperties}', and 'boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, boost::property<boost::vertex_index_t, long unsigned int, tpg::VertexProperties>, boost::property<boost::edge_index_t, long unsigned int, tpg::EdgeProperties>, tpg::GraphProperties>::vertex_bundled {aka tpg::VertexProperties}')
     { return is_root() ? m_graph[x] : root().m_graph[local_to_global(x)]; }
                        ^
boost/graph/subgraph.hpp: In member function 'typename boost::graph::detail::bundled_result<Graph, Descriptor>::type& boost::subgraph<Graph>::operator[](Descriptor) [with Descriptor = boost::graph_bundle_t; Graph = boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS, boost::property<boost::vertex_index_t, long unsigned int, tpg::VertexProperties>, boost::property<boost::edge_index_t, long unsigned int, tpg::EdgeProperties>, tpg::GraphProperties>; typename boost::graph::detail::bundled_result<Graph, Descriptor>::type = tpg::GraphProperties]':
boost/graph/subgraph.hpp:278:75: warning: control reaches end of non-void function [-Wreturn-type]
     { return is_root() ? m_graph[x] : root().m_graph[local_to_global(x)]; }

workaround/hack: explicitly use local_property or global_property lookup classes.

auto name = graph[boost::global_property<boost::graph_bundle_t>(boost::graph_bundle)].name;

Change History (0)

Note: See TracTickets for help on using tickets.