fork download
  1. template <typename T_graph, typename T_label>
  2. struct vertex_tmpl {
  3. typedef typename T_graph::edge_t edge_t;
  4. edge_t* edge;
  5. // .... maybe some more edges ....
  6. };
  7.  
  8. template <typename T_graph, typename T_weight>
  9. struct edge_tmpl {
  10. typedef typename T_graph::vertex_t vertex_t;
  11. vertex_t* vertex;
  12. };
  13.  
  14. template < template <typename, typename> class T_vertex,
  15. template <typename, typename> class T_edge,
  16. typename T_weight = int,
  17. typename T_label = int >
  18. struct graph_tmpl {
  19. typedef graph_tmpl< T_vertex, T_edge> self_t;
  20. typedef T_vertex<self_t, T_label> vertex_t;
  21. typedef T_edge<self_t, T_weight> edge_t;
  22. };
  23.  
  24. int main() {
  25. typedef graph_tmpl< vertex_tmpl, edge_tmpl> graph_t;
  26. typedef typename graph_t::edge_t basic_edge;
  27. typedef typename graph_t::vertex_t basic_vertex;
  28.  
  29. basic_edge edge;
  30. basic_vertex vertex;
  31. vertex.edge = &edge;
  32. edge.vertex = &vertex;
  33. }
Success #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty