title: what does the operator string() { some code } do?
body: <p>I have the following code in a class:</p>
  
  <pre><code>operator string() {
          return format("CN(%d)", _fd);
  }
  </code></pre>
  
  <p>And wanted to know what this operator does.</p>
  
  <p>I am familiar with the usual string operators:</p>
  
  <pre><code>bool operator==(const string&amp; c1, const string&amp; c2);
  bool operator!=(const string&amp; c1, const string&amp; c2);
  bool operator&lt;(const string&amp; c1, const string&amp; c2);
  bool operator&gt;(const string&amp; c1, const string&amp; c2);
  bool operator&lt;=(const string&amp; c1, const string&amp; c2);
  bool operator&gt;=(const string&amp; c1, const string&amp; c2);
  string operator+(const string&amp; s1, const string&amp; s2 );
  string operator+(const Char* s, const string&amp; s2 );
  string operator+( Char c, const string&amp; s2 );
  string operator+( const string&amp; s1, const Char* s );
  string operator+( const string&amp; s1, Char c );
  string&amp; operator+=(const string&amp; append);
  string&amp; operator+=(const Char* append);
  string&amp; operator+=(const Char  append);
  ostream&amp; operator&lt;&lt;( ostream&amp; os, const string&amp; s );
  istream&amp; operator&gt;&gt;( istream&amp; is, string&amp; s );
  string&amp; operator=( const string&amp; s );
  string&amp; operator=( const Char* s );
  string&amp; operator=( Char ch );
  Char&amp; operator[]( size_type index );
  const Char&amp; operator[]( size_type index ) const;
  </code></pre>
  
  <p>... but not this one?</p>