Merge pull request #415 from AnthonyVH/anthonyvh/fix_named_graph_copy

Ensure named_graph base class is initialized before accessing it
This commit is contained in:
Jeremy W. Murphy 2025-02-04 21:10:47 +11:00 committed by GitHub
commit cbb91297ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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();
}