“error: Expected a type, got 'classname'” in C++

后端 未结 1 944
栀梦
栀梦 2021-02-20 16:56

Using the following code:

template 
class node {
    [. . .]
};
class b_graph {
friend istream& operator>> (istream& in, b_graph&         


        
相关标签:
1条回答
  • 2021-02-20 17:50

    node is not a class, it's a class template. You need to instantiate it to use it as the element type of vector, e.g.,

    vector<node<int> > vertices;
    

    (int is used as an example; you should use the type you actually need)

    0 讨论(0)
提交回复
热议问题