How do I use the class-name inside the class itself as a template argument?

后端 未结 2 986
日久生厌
日久生厌 2021-01-04 11:43

I\'ve got a templated class having two template paramters

template  class A  /* ... */

and another template class t

2条回答
  •  太阳男子
    2021-01-04 12:16

    If class A is defined before class B, I'm getting the error: 'B' does not name a type (in other words, B is not defined yet). Is this the error you are getting? It can be fixed either by placing B in front of A, or, if the two are referencing each other, by forward-declaring class B before A like this:

    template  class Z> class B;
    

提交回复
热议问题