这里是我的模板函数模板功能将无法编译
template<typename T> std::stringstream logging_expansion (T const * value){
std::stringstream retval;
retval = retval << *value;
return retval;
}
这是我如何把它用它
logging_expansion("This is the log comes from the convinient function");
但链接是告诉我,它不能引用函数:
Undefined symbols for architecture x86_64:
"std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> > logging_expansion<char>(char const*)", referenced from:
_main in WirelessAutomationDeviceXpcService.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我认为你可以从字面上写'return(std :: stringstream()<< * value);'在一行中。 – 2012-02-09 19:11:22