fork download
  1. #include <iostream>
  2.  
  3. template <typename T>
  4. inline void pushstring(T str);
  5.  
  6. template <int N>
  7. inline void pushstring(const char (&str) [N])
  8. {
  9. std::cout << N << std::endl;
  10. }
  11.  
  12. template <>
  13. inline void pushstring(const char *str)
  14. {
  15. std::cout << str << std::endl;
  16. }
  17.  
  18. int main()
  19. {
  20. const char *x = "Hello?";
  21. pushstring(1);
  22. pushstring(x);
  23. pushstring("Hi");
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4: warning: inline function ‘void pushstring(T) [with T = int]’ used but never defined
/home/JK0jhI/ccIBVpIg.o: In function `main':
prog.cpp:(.text+0x4d): undefined reference to `void pushstring<int>(int)'
collect2: ld returned 1 exit status
stdout
Standard output is empty