title: how to tell if a C++ template type is C-style string
body: <p>I am trying to write a template <code>is_c_str</code> to test if a type is a c-style string. I need this as an attempt to write a to_string function, as shown in my other question here:
  <a href="https://stackoverflow.com/questions/24848156/how-to-write-template-specialization-for-iterators-of-stl-containers">Template specialization for iterators of STL containers?</a>. </p>
  
  <p>I need to tell apart c_str and other types of pointers and iterators, so that I can represent the first at the face value, and render pointers/iterators as an opaque "itor" or "ptr". The code is as follows:</p>
  
  <pre><code>#include &lt;iostream&gt;
  template&lt;class T&gt;
  struct is_c_str
    : std::integral_constant&lt;
    bool,
    !std::is_same&lt;char *, typename std::remove_reference&lt;typename std::remove_cv&lt;T&gt;::type&gt;::type&gt;::value
  &gt; {};
  
  int main() {
    auto sz = "Hello";  //Or: const char * sz = "Hello";
    int i;
    double d;
    std::cout &lt;&lt; is_c_str&lt;decltype(sz)&gt;::value &lt;&lt; ", "
          &lt;&lt; is_c_str&lt;decltype(i)&gt;::value &lt;&lt; ", "
          &lt;&lt; is_c_str&lt;decltype(d)&gt;::value &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>However, <code>is_c_str</code> captures not only <code>const char *</code>, but also <code>int</code> and <code>double</code>. The above code outputs:</p>
  
  <pre><code>1, 1, 1
  </code></pre>
  
  <p>(as of gcc-4.8.1).</p>
  
  <p>My question is how to fix <code>is_c_str</code> to properly capture c-style strings?</p>