Got a savage few compile errors while trying to use Boost.Graph. The error is a regression as it is not present when compiling 1.55.0. I've dug a bit but can't fix it, does anyone know what is going wrong here?
Notes: Using the -std=c++0x compile flag
Code that will generate the errors.
#include "boost/graph/adjacency_list.hpp"
int main(int argc, char** argv)
{
using boost::adjacency_list;
using boost::vecS;
using boost::directedS;
typedef adjacency_list<vecS, vecS, directedS, boost::default_color_type> Graph;
std::vector< std::pair<int, int> > testVec;
auto graph = Graph( begin(testVec), end(testVec), testVec.size());
return 0;
}
Errors copied out of my IDE
/usr/include/c++/4.6/bits/vector.tcc:319: error: use of deleted function ‘boost::detail::stored_edge_property::self& boost::detail::stored_edge_property::operator=(boost::detail::stored_edge_property::self&&) [with Vertex = long unsigned int, Property = boost::no_property, boost::detail::stored_edge_property::self = boost::detail::stored_edge_property]’
.../boost/boost/graph/detail/adjacency_list.hpp:318: error: ‘boost::detail::stored_edge_property::self& boost::detail::stored_edge_property::operator=(boost::detail::stored_edge_property::self&&) [with Vertex = long unsigned int, Property = boost::no_property, boost::detail::stored_edge_property::self = boost::detail::stored_edge_property]’ is implicitly deleted because the default definition would be ill-formed:
.../boost/boost/graph/detail/adjacency_list.hpp:318: error: base ‘boost::detail::stored_edge’ does not have a move assignment operator or trivial copy assignment operator
/usr/include/c++/4.6/bits/stl_algobase.h:546: error: use of deleted function ‘boost::detail::stored_edge_property::self& boost::detail::stored_edge_property::operator=(boost::detail::stored_edge_property::self&&) [with Vertex = long unsigned int, Property = boost::no_property, boost::detail::stored_edge_property::self = boost::detail::stored_edge_property]’
It appears that the implementation of stored_edge_property
(a under-the-hood class to store edge properties) was updated for C++11 rvalue references between the version 1.55 to 1.56 (you can see it clearly by diff'ing the files). It appears that they forgot to provide a move-assignment operator for its base class stored_edge
(and the default one is implicitly disabled by the presence of a copy-assignment operator).
This is definitely a bug and should be reported to Boost. I remember that they made a virtually identical mistake with shared_ptr
around the 1.48 version. I guess people don't always learn from their own mistakes. The fix is trivial, but this really should have been caught before release (it seems like a very easy bug to catch in a unit-test). Please report your findings to their bug tracker.
N.B.: I use BGL a lot, but I have learned to distrust their adjacency_list
implementation, especially after looking through it extensively. I now use my own implementation of it (see here) which cuts through a lot of the fat of the monstrous implementation that the BGL carries around.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With