Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your only providing a linkable object for the class in the translation unit, but the member function is templated on another parameter and has also to be explicitly specified.</p> <p>I don't know if there is a more elegant way, but one compilable version would be:</p> <pre><code>template bool IShader&lt;bool&gt;::getProperty&lt;bool&gt; (const std::string&amp; propertyName, ShaderProperty&lt;bool&gt;** outProp); </code></pre> <p>VC8 and GCC 3.4 both allow to leave out the <code>&lt;bool&gt;</code> after the function name. I'm however not sure about the correct syntax in that case.</p> <p>But as long as you're not having problems with the compilation time in a big project, save yourself the trouble and put the method definitions (marked inline) in a header.<br> If you're just worried about the size of the header file, move the definitions in another header file, e.g. <em>IShaderImpl.h</em>, that you include at the end of <em>IShader.h</em>.</p> <p>Quick sample to remove doubts:</p> <pre><code>// IShader.h template&lt;typename T&gt; struct ShaderProperty {}; template &lt;typename T&gt; class IShader { public: template &lt;typename U&gt; void getProperty(ShaderProperty&lt;U&gt;**); }; // IShader.cpp #include &lt;iostream&gt; #include "IShader.h" template&lt;typename T&gt; template&lt;typename U&gt; void IShader&lt;T&gt;::getProperty(ShaderProperty&lt;U&gt;**) { std::cout &lt;&lt; "moo" &lt;&lt; std::endl; } template class IShader&lt;bool&gt;; template void IShader&lt;bool&gt;::getProperty(ShaderProperty&lt;bool&gt;**); // main.cpp #include "IShader.h" int main() { IShader&lt;bool&gt; b; ShaderProperty&lt;bool&gt;** p; b.getProperty(p); } </code></pre>
 

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