template class Graph是什么意思?
最近在读程序,遇到一个C++模板问题。
头文件graph.h内容如下:
template <typename T1, typename T2, typename T3> class Graph
{
...// 其余内容省略
}
graph.cpp文件内容如下:
#include "instances.inc"
instances.inc文件内容如下:
template class Graph<int,int,int>;
问题1:template class Graph<int,int,int>;是什么意思?这个语法挺奇怪的。
问题2:为什么要在graph.cpp文件里面又包含instances.inc文件,我怎么觉得instances.inc文件里面的内容是多余的呢?