模板化赋值运算符:有效的C++?

Dan*_*oof 0 c++ static templates class variable-assignment

只是一个快速而简单的问题,但在任何文档中都找不到它.

template <class T>
T* Some_Class<T>::Some_Static_Variable = NULL;
Run Code Online (Sandbox Code Playgroud)

它用g ++编译,但我不确定这是否有效.是吗?

Jar*_*Par 6

是的,这段代码是正确的.有关更多信息,请参阅此C++模板教程

http://www.is.pku.edu.cn/~qzy/cpp/vc-stl/templates.htm#T14