fork download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. template <typename S>
  5. void Show (const S& s, size_t n) {
  6. while (n-- != 0)
  7. std::cout << s << std::endl;
  8. }
  9.  
  10. struct big {
  11. std::string s;
  12. big(const std::string& s):s(s){}
  13. };
  14.  
  15. std::ostream& operator<<(std::ostream& os, const big& b) {
  16. return os << b.s;
  17. }
  18.  
  19. int main() {
  20. std::string s{"string"};
  21. big b{"big"};
  22. Show (s, 2);
  23. Show (b, 3);
  24. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
string
string
big
big
big