using struct template in template class implementation

前端 未结 1 1307
庸人自扰
庸人自扰 2021-01-28 17:32

I am trying to learn templates usage in c++. I have created a struct node which I am using in queue class implementation but I am getting compiler error: Error\" expected type s

1条回答
  •  死守一世寂寞
    2021-01-28 18:12

    Your new has a syntax error.

    qnode* temp = new qnode;
    

    should be

    qnode* temp = new qnode();
    

    Remember, a template class without template parameters is meaningless to the compiler. Whenever you type qnode (after the initial declaration), you need to type its template parameters as well!

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