fix: handroll mpl facilities#529
Conversation
|
Compiler-warning counts vs
|
|
Boost dependency footprint vs Header-inclusion weights (graph files pulling each direct dependency in):
Transitive Boost modules: 69 → 69 (0) |
|
Now I realise that we're trying to reduce dependencies here, but would it be appropriate to use mp11 to replace the functionality in mpl? |
|
It was originally the plan to move from MPL to MP11 because I thought the features required across BGL were non trivial. But all changes are trivial conversions to standard equivalent. It means that pulling in MP11 would be only to avoid those 15 lines. It would have been > 100 lines for an equivalent that may have justified pulling in MP11 but in that case I don't think it's worth, as it may as well become portable if we go C++17 (looks like the numbers of liens required in c++17 for the same behavior is divided by 2) |
Continue removing MPL from the codebase to limit build times and dependencies.
But this time there is no direct C++ equivalent to the MPL features, so there is a small utility
graphml_detailnamespace.Before submitting
developbranch.Type of change
Does this PR introduce a breaking change?
What this PR does
The GraphML reader and writer kept a compile-time list of the value types they support (
bool,int,double,string, and so on) and used three Boost.MPL tools on it:mpl::vector(the list of types),mpl::for_each(visit each type once, to try each candidate when parsing),mpl::find(get a type's position to look up its name).Their replacement is ~15 lines of plain C++ in a small
graphml_detailnamespace:value_type_listtype list,for_each_value_typethat visits each type in orderindex_of_value_typethat gives a type's position.No behavior change, and no new dependency (no Boost.MP11).
Motivation
Part of the ongoing effort to shrink Boost.Graph's dependency footprint. Boost.MPL is an old, heavy, slow-to-compile library that modern C++ (
<type_traits>plus small hand-written helpers) can replace directly. This removes the last direct MPL use from BGL that would not be breaking public API.Testing
Checklist
b2in thetest/directory).