Name lookups in C++ templates

后端 未结 3 1651
情话喂你
情话喂你 2020-11-29 02:05

I have some C++ code that is no longer compiling without the -fpermissive option. It\'s propriety code that I can\'t share, but I\'ve think I\'ve been able to extract a simp

3条回答
  •  天命终不由人
    2020-11-29 02:54

    If your base class is a template instance, then there's no way to know that next refers to a name in the base class -- after all, the name needn't even exist (think about specializations)! Thus, you have to assert to the compiler that next is actually a class member by saying this->, or List::next, or by prepending using List::next; to your derived class template.

提交回复
热议问题