Opened 6 years ago

Last modified 6 years ago

#12555 new Bugs

Graph headers are not self-contained

Reported by: gromer@… Owned by: Jeremiah Willcock
Milestone: To Be Determined Component: graph
Version: Boost 1.60.0 Severity: Problem
Keywords: Cc:

Description

Many BGL header files are not self-contained, meaning that they will not compile if #included into a translation unit that doesn't #include anything else. For example, boost/graph/bandwidth.hpp refers to vertex_index, but does not #include boost/graph/properties.hpp, the header which declares vertex_index.

Among other things, this prevents BGL from being adapted to take advantage of C++ modules (see http://clang.llvm.org/docs/Modules.html), because modules require headers to be self-contained.

Attached is a patch (against 1.60.0) to correct these problems, usually by adding missing #includes. The change to howard_cycle_ratio.hpp is slightly more subtle: the problem there is that the code refers to boost::num_edges(g), but doesn't #include a header that declares that function. However, the choice of the right header to #include depends on the type Graph of g, which is a template parameter. This points to the real problem: this code should be calling num_edges(g) unqualified, so that it uses argument-dependent lookup to find the num_edges() overload in the namespace of Graph, rather than restricting itself to the overloads defined in namespace boost.

Attachments (2)

boost-graph.patch (13.8 KB ) - added by gromer@… 6 years ago.
Patch to fix isue
boost-graph.2.patch (12.7 KB ) - added by gromer@… 6 years ago.
Corrected patch

Download all attachments as: .zip

Change History (3)

by gromer@…, 6 years ago

Attachment: boost-graph.patch added

Patch to fix isue

by gromer@…, 6 years ago

Attachment: boost-graph.2.patch added

Corrected patch

comment:1 by anonymous, 6 years ago

Apologies, I made a mistake in generating the initial patch; please use boost-graph.2.patch instead.

Note: See TracTickets for help on using tickets.