title: Template constraints in C++11
body: <pre><code>template&lt;typename T&gt;
  T add(T a, T b){
      static_assert(std::is_integral&lt;T&gt;::value 
                   || std::is_floating_point&lt;T&gt;::value
                   , "Not a numeric value");
      return a + b;
  }
  </code></pre>
  
  <p>Are there other/better ways to enforce constraints on templates?</p>