Note that there are some explanatory texts on larger screens.

plurals
  1. POimport all variables of parent class
    text
    copied!<p>You may have notice that later versions of gcc is more strict with standards (<a href="https://stackoverflow.com/questions/605497/accessing-inherited-variable-from-templated-parent-class">see this question</a>)</p> <p>All inherited members of a template class should be called using the full name, ie. <code>ParentClass&lt;T&gt;::member</code> instead of just <code>member</code></p> <p>But still I have a lot of old code that does not respect this. Adding <code>using ParentClass&lt;T&gt;::member</code> for each used member in each class is quite a pain. Is there is a way to do something like <code>using ParentClass&lt;T&gt;::*</code> ?. I would like this better than deactivating this check in g++ but if there is now way, how can I deactivate it ? </p> <p><strong>Edit</strong>:</p> <p>According to C++ FAQ (thanks sth) these are the only way to correctly solve the inherited member variable names : </p> <ol> <li><p>Change the call from <code>f()</code> to <code>this-&gt;f()</code>. Since this is always implicitly dependent in a template, <code>this-&gt;f</code> is dependent and the lookup is therefore deferred until the template is actually instantiated, at which point all base classes are considered.</p></li> <li><p>Insert <code>using B&lt;T&gt;::f</code>; just prior to calling <code>f()</code>.</p></li> <li><p>Change the call from f() to <code>B&lt;T&gt;::f()</code>. </p></li> </ol> <p>So now looking for the right switch to deactivate the full name resolution ...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload