fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4.  
  5. //namespace A {
  6. template<typename T>
  7. std::ostream& operator<<(std::ostream& ofs, const std::vector<T>& vec)
  8. {
  9. ofs << vec.size() << std::endl;
  10. for (size_t i = 0; i < vec.size(); i++)
  11. ofs << vec[i] << std::endl;
  12. return ofs;
  13. }
  14. //}
  15. namespace B {
  16. void func()
  17. {
  18. std::vector<std::string> vec{"A", "B", "C"};
  19. std::cout << vec <<::std::endl;
  20. }
  21. }
  22. int main()
  23. {
  24. B::func();
  25. return 0;
  26. }
  27.  
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
3
A
B
C