这是我在尝试编译时得到的。
是类的代码:
template <typename T>
class graph{
private:
vector<int> bfs, dfs;
vector<bool> visited;
void _dfs(int index);
public:
vector<T> bfs_data, dfs_data;
vector<T>::iterator dfs_order(int index, int a);//C4430, C2146 error
它是函数代码(它们在一个cpp文件中):
template class graph<int>;
template class graph<double>;
template class graph<char>;
template <typename T>
void graph<T>::_dfs(int index)
[...]
template <typename T>
vector<T>::iterator graph<T>::dfs_order(int index, int a)//C2143 error
[...]
我需要将迭代器返回到带有用户类型数据的向量的函数。 错误:
C4430: missing type specifier
C2146: missing ';' before identifier
C2143: missing ';' before 'graph<T>::dfs_order'
那我该怎么办呢? :(