// problem.cpp:
#include <string>
template<typename T> void func(const T & v);
int main() {
int i;
float f;
char * cp;
char ca[4];
func(i);
func(f);
func(cp);
func(std::string("std::string"));
func(ca);
func("string_literal");
return 0;
}
// problem2.cpp
#include <string>
template<typename T> void func(const T & v);
// undefined reference to `void func<int>(int const&)'
template<> void func<int>(const int & v) { }
// undefined reference to `void func<float>(float const&)'
template<> void func<float>(const float & v) { }
// undefined reference to `void func<char*>(char* const&)' …
Run Code Online (Sandbox Code Playgroud)