title: C++ template specialization for specific values
body: <p>I have struct <code>Opers</code> with some arithmetic operations: <code>mult()</code>, <code>div()</code>, <code>mod()</code>. </p>
  
  <p>And I need to specialize template for certain values of <code>n</code>. Here is example for <code>Opers&lt;1&gt;</code>. </p>
  
  <p>But, also I want to do specialization for <code>n</code> that are powers of 2 ( n = 2,4,8,16, ...) – in this case I can optimize operations <code>mult()</code>  and <code>div()</code> (using bitwise shift left or right).</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  template&lt;int n&gt; struct Opers {
      int mult(int x){
          return n*x;
      }
      int div(int x){
          return x / n;
      }   
      int mod(int x){
          return x % n;
      }   
  };
  template&lt;&gt; struct Opers&lt;1&gt; {
      int mult(int x){
          return 1;
      }
      int div(int x){
          return x;
      }   
      int mod(int x){
          return 0;
      }           
  };
  int main() {
      Opers&lt;1&gt; el2;
      cout &lt;&lt; el2.mult(3) &lt;&lt;endl;
  } 
  </code></pre>
  
  <p>I'm looking for construction like</p>
  
  <pre><code>template&lt;&gt; struct Opers&lt;isPowerOfTwo()&gt;
      int mult(int x){
          // do smth
       }
  </code></pre>
  
  <p>Is it possible or what manual should I read?</p>
  
  <p><strong>UPD.</strong> Using C++11 is allowed, and even would be better.</p>