title: What is wrong with this use of std::enable_if?
body: <p>I have a function <code>set_data</code> which I have to implement in different ways for different types it takes in. For example, this is trying to implement two overloads based on input type. If it is fundamental, non <code>void</code> and non <code>nullptr_t</code>, then handle it in first implementation. If it is a <code>std::string</code> or a <code>char</code> buffer, handle it second way. </p>
  
  <pre><code>struct field
  {
      template&lt;typename TDataType, typename=void&gt;
      void set_data(TDataType data, size_t index = 0);
  };
  
  template&lt;typename TDataType, typename = typename
          std::enable_if&lt; std::is_fundamental&lt;TDataType&gt;::value &amp;&amp;
                          std::is_same&lt;TDataType, nullptr_t&gt;::value == false &amp;&amp;
                          std::is_same&lt;TDataType, void&gt;::value == false&gt;::type&gt;
  void field::set_data(TDataType data, size_t index /* = 0 */)
  {
  }
  
  template&lt;typename TDataType, typename = typename
          std::enable_if&lt; std::is_same&lt;std::string const &amp;, TDataType&gt; ||
                          std::is_same&lt;char const *, TDataType&gt;&gt;::type&gt;
  void field::set_data(TDataType data, size_t index /* = 0 */)
  {
  }
  </code></pre>
  
  <p>Then I call like :</p>
  
  <pre><code>field f;
  int x = 10;
  f.set_data(x);
  </code></pre>
  
  <p>And the compiler throws an error at me.</p>
  
  <pre><code>defs.h(111): error C2995: 'void messaging::field::set_data(TDataType,size_t)' : function template has already been defined
  </code></pre>
  
  <p>How do I resolve this?</p>
  
  <p>On Visual studio 2013</p>