У меня есть вопрос, связанный с библиотекой графов наддува.
boost::adajacency_list
имеет конструктор из диапазона итераторов ребер и количества вершин.
template <class EdgeIterator>
adjacency_list(EdgeIterator first, EdgeIterator last,
vertices_size_type n,
edges_size_type m = 0,
const GraphProperty& p = GraphProperty())
Я пытаюсь использовать этот конструктор со следующим кодом,
#include <boost/graph/adjacency_list.hpp>
using namespace boost;
using Graph = adjacency_list<>;
int main()
{
using edge_iterator = graph_traits<Graph>::edge_iterator;
Graph g;
auto const vd0 = add_vertex(g);
auto const vd1 = add_vertex(g);
add_edge(vd0, vd1, g);
edge_iterator ei, ej;
tie(ei, ej) = edges(g);
Graph h(ei, ej, 2);
return 0;
}
Код не компилируется со следующей ошибкой,
/usr/include/boost/graph/detail/adjacency_list.hpp:2121:29: error: ‘boost::detail::adj_list_edge_iterator<boost::range_detail::integer_iterator<long unsigned int>, boost::detail::out_edge_iter<__gnu_cxx::__normal_iterator<boost::detail::stored_edge_property<long unsigned int, boost::no_property>*, std::vector<boost::detail::stored_edge_property<long unsigned int, boost::no_property>, std::allocator<boost::detail::stored_edge_property<long unsigned int, boost::no_property> > > >, long unsigned int, boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>, long int>, boost::adjacency_list<> >::value_type {aka class boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>}’ has no member named ‘first’
add_edge((*first).first, (*first).second,
~~~~~~~~~^~~~~
/usr/include/boost/graph/detail/adjacency_list.hpp:2121:45: error: ‘boost::detail::adj_list_edge_iterator<boost::range_detail::integer_iterator<long unsigned int>, boost::detail::out_edge_iter<__gnu_cxx::__normal_iterator<boost::detail::stored_edge_property<long unsigned int, boost::no_property>*, std::vector<boost::detail::stored_edge_property<long unsigned int, boost::no_property>, std::allocator<boost::detail::stored_edge_property<long unsigned int, boost::no_property> > > >, long unsigned int, boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>, long int>, boost::adjacency_list<> >::value_type {aka class boost::detail::edge_desc_impl<boost::directed_tag, long unsigned int>}’ has no member named ‘second’
add_edge((*first).first, (*first).second,
Ссылка : https://www.boost.org/doc/libs/1_37_0/libs/graph/doc/adjacency_list.html