Note that there are some explanatory texts on larger screens.

plurals
  1. POtemplate-id does not match any template delcaration
    primarykey
    data
    text
    <p>I'm getting a frustrating compiler error I can't seem to work around. It's to do with the template specialization but I can't see what's wrong...</p> <pre><code>../../include/thread/lock_guard.inl:23: error: template-id 'lock_guard&lt;&gt;' for 'thread::lock_guard&lt;thread::null_mutex&gt;::lock_guard(thread::null_mutex&amp;)' does not match any template declaration ../../include/thread/lock_guard.inl:23: error: invalid function declaration ../../include/thread/lock_guard.inl:29: error: template-id 'lock_guard&lt;&gt;' for 'thread::lock_guard&lt;thread::null_mutex&gt;::~lock_guard()' does not match any template declaration ../../include/thread/lock_guard.inl:29: error: invalid function declaration </code></pre> <p>The code is as follows:</p> <pre><code> #include "thread/mutex.hpp" namespace thread { template &lt;typename T&gt; class lock_guard { public: lock_guard(T&amp; lock); ~lock_guard(); private: mutable T&amp; m_lock; mutable int m_state; }; template &lt;&gt; class lock_guard&lt;null_mutex&gt; { public: lock_guard(null_mutex&amp;); ~lock_guard(); }; } //namespace #include "thread/lock_guard.inl" ------------------------------------ #include "thread/lock_guard.hpp" namespace thread { template &lt;typename T&gt; lock_guard&lt;T&gt;::lock_guard(T&amp; lock) : m_lock(lock), m_state(lock.lock()) { /* do nothing */ } template &lt;typename T&gt; lock_guard&lt;T&gt;::~lock_guard() { if(0 == m_state) { m_lock.unlock(); } } template &lt;&gt; lock_guard&lt;null_mutex&gt;::lock_guard(null_mutex&amp;) { /* do nothing */ } template &lt;&gt; lock_guard&lt;null_mutex&gt;::~lock_guard() { /* do nothing */ } } //namespace </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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