title: Proper use of std::enable_if or how to replace it
body: <p>Is this proper use of std::enable_if?
  It works, but is it correct?</p>
  
  <pre><code>//*.h file
  
  template &lt;typename T&gt;
  static typename std::enable_if&lt;std::is_integral&lt;T&gt;::value, T&gt;::type 
  randomFrom(const T min, const T max);
  
  
  template &lt;typename T&gt;
  static typename std::enable_if&lt;std::is_floating_point&lt;T&gt;::value, T&gt;::type 
  randomFrom(const T min, const T max);
  </code></pre>
  
  <p>. </p>
  
  <pre><code>//*.inl file
  
  template &lt;typename T&gt;
  inline typename std::enable_if&lt;std::is_integral&lt;T&gt;::value, T&gt;::type 
  Math::randomFrom(const T min, const T max)
  {
      static std::default_random_engine re((unsigned long)time(0));
      std::uniform_int_distribution&lt;T&gt; uni(min, max);
      return static_cast&lt;T&gt;(uni(re));
  }
  
  template &lt;typename T&gt;
  inline typename std::enable_if&lt;std::is_floating_point&lt;T&gt;::value, T&gt;::type 
  Math::randomFrom(const T min, const T max)
  {
      static std::default_random_engine re((unsigned long)time(0));
      std::uniform_real_distribution&lt;T&gt; uni(min, max);
      return static_cast&lt;T&gt;(uni(re));
  }
  </code></pre>
  
  <p>How can I rewrite it, to achieve cleaner interface? Like:</p>
  
  <pre><code>template &lt;typename T&gt;
  static T randomFrom(const T min, const T max);
  </code></pre>
  
  <p>BTW with boost I had something like:
  (i do not want to use boost)</p>
  
  <pre><code>typedef typename boost::mpl::if_&lt;
          boost::is_floating_point&lt;T&gt;,
          boost::uniform_real&lt;&gt;,
          boost::uniform_int&lt;&gt;&gt;::type dist_type;
  </code></pre>
  
  <p>and whole behavior was solved in single function. But there is nothing like <code>std::if</code> right?</p>