drop dependency on Boost.Bimap and Boost.Lambda - #535
Conversation
|
Boost dependency footprint vs Header-inclusion weights (graph files pulling each direct dependency in):
Transitive Boost modules: 68 → 66 (-2)
|
|
Compiler-warning counts vs
|
f124994 to
ae0ecf5
Compare
ae0ecf5 to
b355d10
Compare
jeremy-murphy
left a comment
There was a problem hiding this comment.
I just want to look at this on a proper computer screen but I'm feeling very favourable towards it. 😅
|
Take your time the PR is not going anywhere ahaha |
| { | ||
| std::vector< Edge > store; | ||
| // i is a dense position in [0, n), so unchecked access is safe. | ||
| const Edge& at(std::size_t i) const { return store[i]; } |
There was a problem hiding this comment.
By convention, at(std::size_t i) is checked access, meaning it will throw an exception if i is out of range. Ideally, we want to provide operator[](std::size_t i), which is unchecked, although I can see that will mean a lot of trivial changes from at(i) to [i].
There was a problem hiding this comment.
I think I disagree with this direction, that is modifying the public API semantics based on a change of the implementation detail.
The point of the wrapper was to serve as a switch with the old Bimap interface. I do think we should still respect its semantics (who knows, if std::bimap arrives someday).
Concretely, for a map the semantics is different between at() and operator[], particularly concerning insertion/throwing.
I was ok changing the internal access because we have the guarantee it will remain in scope, but from the calling site perspective we must preserve the semantics that we don't intend to insert an element (or whatever UB Bimap would be doing if unchecked access) if it does not exist.
Happy to discuss though, as you said its a trivial change, but I keep thinking they had a reason to use the at(i) rather than [i]
Drop Boost.Bimap dependency
Before submitting
developbranch.Type of change
Does this PR introduce a breaking change?
What this PR does
Drop the Boost.Bimap dependency, adds a thin wrapper with similar interface.
Motivation
two_graphs_common_spanning_trees.hppis the only user of Bimap in Boost.Graph (and actually in the entire Boost ecosystem).mpl,multi_index,mp11,lambda, ...) for a container used read-only. It's a blocker to get rid of MPL and other deprecated Boost libs since they will keep popping up through the transitive dependencies chain.left.at,right.at,right.find,insert.0..n-1(plain array indexing), so only edge-to-position needs a map. Astd::vectorplus astd::mapcover both directions; a bidirectional-map library is the wrong tool.Testing
Same tests hold.
Checklist
b2in thetest/directory).