fork download
  1. #include <map>
  2.  
  3. class FSRVertex; // fwd
  4.  
  5. template <class FSRVertex_Forward = FSRVertex> // make the fwd default type
  6. class FSREdge_ {
  7. public:
  8. char fC;
  9. FSRVertex_Forward fTarget;
  10.  
  11. FSREdge_(char c, FSRVertex_Forward target)
  12. :fC(c), fTarget(target)
  13. {}
  14.  
  15. FSREdge_(const FSREdge_ &other) // std::map requires copy ctor
  16. :fC(other.fC), fTarget(other.fTarget)
  17. {}
  18.  
  19. FSREdge_() // std::map requires default ctor
  20. {}
  21. };
  22.  
  23. typedef FSREdge_<> FSREdge; // so that you don't have to carry the brackets everywhere
  24.  
  25. class FSRVertex {
  26. public:
  27. std::map<char, FSREdge> fOutEdges;
  28. FSRVertex()
  29. :fOutEdges()
  30. {}
  31. };
  32.  
  33. int main() {
  34. // your code goes here
  35.  
  36. FSRVertex vertex;
  37. FSREdge edge('a', vertex);
  38. vertex.fOutEdges['a'] = edge;
  39.  
  40. return 0;
  41. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
Standard output is empty