fork(1) download
  1. #include <boost/graph/adjacency_list.hpp>
  2.  
  3. struct TreeVertex
  4. {
  5. int _id = -1;
  6. };
  7.  
  8. typedef boost::adjacency_list<
  9. boost::vecS,
  10. boost::vecS,
  11. boost::directedS,
  12. TreeVertex
  13. > tree_t;
  14. //typedef typename boost::graph_traits<tree_t>::vertex_descriptor vertex_t;
  15.  
  16. int main() {
  17. tree_t tree;
  18. auto v1 = boost::add_vertex( tree );
  19. auto v2 = boost::add_vertex( tree );
  20. auto v3 = boost::add_vertex( tree );
  21. boost::add_edge( v1, v2, tree );
  22. boost::add_edge( v2, v3, tree );
  23.  
  24. auto pair_it_edge = boost::in_edges( v2, tree );
  25. }
  26.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'int main()':
prog.cpp:24:48: error: no matching function for call to 'in_edges(unsigned int&, tree_t&)'
  auto pair_it_edge = boost::in_edges( v2, tree ); 
                                                ^
In file included from /usr/include/boost/graph/adjacency_list.hpp:246:0,
                 from prog.cpp:1:
/usr/include/boost/graph/detail/adjacency_list.hpp:1051:5: note: candidate: template<class Config> std::pair<typename Config::in_edge_iterator, typename Config::in_edge_iterator> boost::in_edges(typename Config::vertex_descriptor, const boost::undirected_graph_helper<C>&)
     in_edges(typename Config::vertex_descriptor u,
     ^
/usr/include/boost/graph/detail/adjacency_list.hpp:1051:5: note:   template argument deduction/substitution failed:
prog.cpp:24:48: note:   'tree_t {aka boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, TreeVertex>}' is not derived from 'const boost::undirected_graph_helper<C>'
  auto pair_it_edge = boost::in_edges( v2, tree ); 
                                                ^
In file included from /usr/include/boost/graph/adjacency_list.hpp:246:0,
                 from prog.cpp:1:
/usr/include/boost/graph/detail/adjacency_list.hpp:1124:5: note: candidate: template<class Config> std::pair<typename Config::in_edge_iterator, typename Config::in_edge_iterator> boost::in_edges(typename Config::vertex_descriptor, const boost::bidirectional_graph_helper<C>&)
     in_edges(typename Config::vertex_descriptor u,
     ^
/usr/include/boost/graph/detail/adjacency_list.hpp:1124:5: note:   template argument deduction/substitution failed:
prog.cpp:24:48: note:   'tree_t {aka boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, TreeVertex>}' is not derived from 'const boost::bidirectional_graph_helper<C>'
  auto pair_it_edge = boost::in_edges( v2, tree ); 
                                                ^
stdout
Standard output is empty