Inheritance of class members, mixed with templates

坚强是说给别人听的谎言 提交于 2019-12-05 20:58:30

You need to use this->m_t to make it a dependent name. When templates are compiled, names are looked up in two stages. Non-dependent names are looked up when the compiler first parses the template. Dependent names are looked up when the template is instantiated. Changing it to this->m_t delays look-up until after the get function is actually instantiated, in which case the base class type is known and the compiler can verify the member's existence.

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