用作模板参数的变量指针必须指向全局变量
#include "stdafx.h"
#include <string>
#include <iostream>
template<const std::string* pContent>
class Test
{
public:
void fun()
{
std::cout << *pContent << std::endl;
}
};
std::string sContent = "Hello, world";
int _tmain(int argc, _TCHAR* argv[])
{
Test<&sContent> val;
val.fun();
return 0;
}