2
0
mirror of https://github.com/boostorg/graph.git synced 2026-01-19 04:12:11 +00:00

Ensure named_graph base class is initialized before accessing it

This commit is contained in:
Anthony Van Herrewege
2025-02-03 15:36:24 +01:00
parent 254d7cbb24
commit 1c295e6830
2 changed files with 13 additions and 7 deletions

View File

@@ -267,18 +267,21 @@ template < class OutEdgeListS = vecS, // a Sequence or an AssociativeContainer
class EdgeProperty = no_property, class GraphProperty = no_property,
class EdgeListS = listS >
class adjacency_list
: public detail::adj_list_gen<
adjacency_list< OutEdgeListS, VertexListS, DirectedS, VertexProperty,
EdgeProperty, GraphProperty, EdgeListS >,
VertexListS, OutEdgeListS, DirectedS, VertexProperty, EdgeProperty,
GraphProperty, EdgeListS >::type,
// Support for named vertices
: // Support for named vertices
// This needs to be inherited from first to ensure it's initialized before the
// "base" (i.e. detail::adj_list_gen), because the "base" might indirectly
// call functions on it during its construction.
public graph::maybe_named_graph<
adjacency_list< OutEdgeListS, VertexListS, DirectedS, VertexProperty,
EdgeProperty, GraphProperty, EdgeListS >,
typename adjacency_list_traits< OutEdgeListS, VertexListS, DirectedS,
EdgeListS >::vertex_descriptor,
VertexProperty >
VertexProperty >,
public detail::adj_list_gen<
adjacency_list< OutEdgeListS, VertexListS, DirectedS, VertexProperty,
EdgeProperty, GraphProperty, EdgeListS >,
VertexListS, OutEdgeListS, DirectedS, VertexProperty, EdgeProperty,
GraphProperty, EdgeListS >::type
{
public:
typedef GraphProperty graph_property_type;

View File

@@ -91,5 +91,8 @@ int main(int, char*[])
BOOST_TEST(map[*find_vertex("Cincinnatti", map)].population == -1);
// Ensure copy constructor properly initializes base classes.
BOOST_TEST_NO_THROW(RoadMap{map});
return boost::report_errors();
}