 <p>For c++98:</p> <p>One way to achieve what you want of requiring an exact match is to have a template method which accepts any type but always fails due to SFINAE:</p> <pre><code> template&lt;typename U&gt; U isFoo(U variable) { typename CheckValidity::InvalidType x; } </code></pre> <p>For c++11:</p> <p>You can use a deleted method to achieve the same effect more cleanly:</p> <pre><code> template&lt;typename U&gt; U isFoo(U variable) = delete; </code></pre>