Opened 6 years ago
Last modified 6 years ago
#12555 new Bugs
Graph headers are not self-contained
| Reported by: | 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)
Change History (3)
by , 6 years ago
| Attachment: | boost-graph.patch added |
|---|
comment:1 by , 6 years ago
Apologies, I made a mistake in generating the initial patch; please use boost-graph.2.patch instead.

Patch to fix isue