fork download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <vector>
  4.  
  5. struct node
  6. {
  7. node( int init )
  8. {
  9. attribute = init;
  10. }
  11. int attribute;
  12. };
  13.  
  14. std::ostream& operator<<( std::ostream& os, const std::pair<int, struct node>& obj )
  15. {
  16. os << obj.first;
  17. os << ";" << obj.second.attribute;
  18. return os;
  19. }
  20.  
  21. int main() {
  22.  
  23. std::vector<std::pair<int, struct node>> path;
  24. path.push_back( std::make_pair( 3, node( 5 ) ) );
  25. std::copy(path.begin(), path.end(), std::ostream_iterator<std::pair<int, struct node>>(std::cout, " "));
  26.  
  27. return 0;
  28. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
3;5