title: Value of const char* returns empty after construction
body: <p>Casting this Vector3 into a const char* has worked in implicit and explicit conversions, but hasn't when attempting to convert it at construction time. Only then does const char* 'v3pchar' return blank. Any thoughts? The full code is below. Thanks!</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  struct Vector3 {
      int x, y, z = 0;
  
      Vector3() {
          cout &lt;&lt; &quot;Vector3()&quot; &lt;&lt; endl;
      };
      
      Vector3(int X, int Y, int Z) : x(X), y(Y), z(Z) {
          cout &lt;&lt; &quot;Vector3(int X, int Y, int Z)&quot; &lt;&lt; endl;
      };
  
      // Focal point here
      operator const char* () {
          cout &lt;&lt; &quot;operator const char* called&quot; &lt;&lt; endl;
          v3string = to_string(x) + &quot;, &quot; + to_string(y) + &quot;, &quot; + to_string(z);
          v3pchar = v3string.c_str();
          return v3pchar;
      }
  
  private:
      string v3string = &quot;Never even blank&quot;;
      const char* v3pchar = &quot;So why does this become blank?&quot;;
  };
  
  int main() {
      Vector3 v1 = Vector3(1, 2, 3);
      cout &lt;&lt; &quot;Vector3 implicit cast to char*: [&quot; &lt;&lt; v1 &lt;&lt; &quot;]&quot; &lt;&lt; endl; // Works
  
      const char* v2 = v1;
      printf(&quot;Vector3 explicit cast to char*: [%s]\n&quot;, (const char*)v2); // Works
  
      cout &lt;&lt; &quot;---------------------------------------------&quot; &lt;&lt; endl;
  
      const char* v3 = Vector3(4, 5, 6);
      cout &lt;&lt; &quot;Vector3 instantiation cast to char*: [&quot; &lt;&lt; v3 &lt;&lt; &quot;]&quot; &lt;&lt; endl; // Empty
  
      return 0;
  };
  </code></pre>