fork(1) download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <string.h>
  5. using namespace std;
  6.  
  7. template<typename T>
  8. int len(T args) { return args.size(); }
  9. template<>
  10. int len(const char * args) { return strlen(args); }
  11.  
  12. int main() {
  13. string a = "Ola Mundo!";
  14. const char *b = "Ola Mundo!";
  15. vector<string> c = {"Ola", "Mundo", "!"};
  16. cout << len(a) << "\n";
  17. cout << len(b) << "\n";
  18. cout << len(c) << "\n";
  19. }
  20.  
  21. //https://pt.stackoverflow.com/q/391548/101
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
10
10
3