Compilation error with boost.graph 1.56.0 and g ++ 4.6.4

It turns out that when trying to use Boost.Graph there are several compilation errors. An error is a regression because it is missing when compiling 1.55.0. I dug a little, but I canโ€™t fix it, does anyone know what is wrong here?

Notes: Using the compilation flag -std = C ++ 0x

Code that will generate 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 from my IDE

/usr/include/++/4.6/bits/vector.tcc: 319: error: using remote 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]

... / gain / increase / 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 as the default value will be poorly formed:

... / boost / boost / graph / detail / adjacency_list.hpp: 318: error: base 'Boost :: detail :: stored_edge has no motion assignment operator or trivial copy assignment operator

/usr/include/++/4.6/bits/stl_algobase.h: 546: error: using remote 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]

+5
source share
1 answer

It seems that the implementation of stored_edge_property (a class under the hood for storing edge properties) has been updated for C ++ 11 rvalue links between version 1.55 to 1.56 (you can clearly see this by delimiting files). It looks like they forgot to provide a forwarding operator for their base class stored_edge (and by default it is implicitly disabled by the presence of the copy operator).

This is definitely a bug and should be reported to Boost. I remember that they made an almost identical mistake with shared_ptr around version 1.48. I think people do not always learn from their mistakes. The fix is โ€‹โ€‹trivial, but it really had to be caught before release (this seems like a very simple bug to catch in a unit test). Tell your findings their error tracker .

NB: I use BGL a lot, but I learned not to trust their implementation of adjacency_list , especially after a thorough study. Now I use my own implementation (see here ), which cuts through a lot of fat of the monstrous implementation that BGL carries.

+5
source

Source: https://habr.com/ru/post/1200716/


All Articles