title: C++ constructors and implicit string conversion
body: <p>In c++, I can write a class with a constructor that takes a <code>std::string</code> parameter. This will allow me to construct instances of this class from either <code>std::string</code> or <code>char *</code>, due to implicit conversions.</p>
  
  <p>Is there ever a reason to have both a <code>std::string</code> constructor and a <code>char *</code> constructor?</p>
  
  <pre><code>class MyStringClass {
   public:
      MyStringClass( const std::string &amp;str ); // char *'s could implicitly use this constructor
      MyStringClass( const char * str );       // would this ever be necessary?
  };
  </code></pre>
  
  <p>This question also applies to function arguments.</p>
  
  <pre><code>void do_stuff_with_string( const std::string &amp;str );
  void do_stuff_with_string( const char * str );
  </code></pre>
  
  <p>Edit:</p>
  
  <p>To clarify, I am wondering more about the performance. Say these constructors/functions are calling into api's that only take <code>char *</code>. Is it worth it to have the two separate functions to avoid constructing a <code>std::string</code> if I don't have to?</p>
  
  <pre><code>void do_stuff_with_string( const std::string &amp;str )
  {
      do_stuff_with_string( str.c_str() );
  }
  
  void do_stuff_with_string( const char * str )
  {
      // call some api that only accepts char *
  }
  </code></pre>