Template class that refers to itself as a template template parameter?

可紊 提交于 2019-12-04 04:12:33

Try this:

template <typename T>
class B
{
    A< ::B > x; // fully qualified name for B
};

According to C++ Standard 14.6.1/2 you should use the normal name of the template (i.e., the name from the enclosing scope, not the injected-class-name).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!