template中能带cout吗?
今天用模板做一个函数 但是在模板函数中的输出没有显示,请问大虾这是怎么会事?
最好给详细解答!
[解决办法]
#include "iostream "
using namespace std;
template <typename T>
void Print(T t)
{
cout < <t < <endl;
}
int main()
{
Print(100);
Print( "Hello STL ");
Print(1.23f);
return 0;
}