Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem is most likely in the fact that you relegated the specializations of your member function <code>runFFT()</code> for <code>int16_t</code> and <code>Ipp32f</code> in a separate <code>.cpp</code> file without providing a corresponding declaration after the primary template, so the compiler at the point of instantiation (which likely belongs to another translation unit that <code>#include</code>s only the header file containing the definition of <code>Client</code>) doesn't know about the existence of those explicit specializations.</p> <p>Put a <em>declaration</em> for those specializations in the same header file that contains the definition of your class template:</p> <pre><code>template&lt;typename T&gt; inline void UnusedParameter( T const&amp; ) { } class Client { public: template&lt;class T&gt; void runFFT(T *wSamples, float const &amp;fMult) { std::cout &lt;&lt; "INSIDE RUNFFT : : :" &lt;&lt; std::endl; UnusedParameter(wSamples); UnusedParameter(fMult); } }; // DECLARE YOUR EXPLICIT SPECIALIZATIONS HERE template&lt;&gt; void Client::runFFT&lt;int16_t&gt;(int16_t *wSamples, float const &amp;fMult); template&lt;&gt; void Client::runFFT&lt;Ipp32f&gt;(Ipp32f *wSamples, float const &amp;fMult); </code></pre> <p>Per Paragraph 14.7.3/6 of the C++11 Standard:</p> <blockquote> <p>If a template, a member template or a <strong>member of a class template</strong> is explicitly specialized then that specialization shall be <strong>declared before the first use of that specialization that would cause an implicit instantiation to take place</strong>, in every translation unit in which such a use occurs; <strong>no diagnostic is required</strong>. [...]</p> </blockquote> <p>The "<em>no diagnostic is required</em>" part means that if you don't follow this rule, your program will be ill-formed, but your compiler/linker is not required to tell you. This normally results in the kind of undefined behavior you are observing.</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