fork(2) download
  1. #include <iostream>
  2. #include <initializer_list>
  3. #include <vector>
  4. #include <string>
  5. #include <iterator>
  6.  
  7. template<typename T>
  8. void printme(T&& t) {
  9. for(auto it = t.begin(); it != t.end(); ++it)
  10. std::cout << *it;
  11. }
  12.  
  13. template<typename T>
  14. void printme(std::initializer_list<T> t) {
  15. for(auto it = t.begin(); it != t.end(); ++it)
  16. std::cout << *it;
  17. }
  18.  
  19. int main() {
  20. printme(std::vector<char>({'a', 'b', 'c'}));
  21. printme(std::string("abc"));
  22. printme({'a', 'b', 'c'});
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 3016KB
stdin
Standard input is empty
stdout
abcabcabc