title: Is there an analogous function to `vsnprintf` that works with `std::string`
body: <p>I don't see a constructor for <code>std::string</code> that can consume a <code>va_list</code>. Is there a common solution for converting a <code>va_list</code> to a <code>std::string</code>?</p>
  <p>I've seen solutions in the form of:</p>
  <pre><code>std::string vstring (const char * format, ...) {
    std::string result;
  
    va_list args;
    va_start(args, format);
  
    char buffer[1024];
    vsnprintf(buffer, sizeof(buffer), format, args);
    result = std::string(buffer);
  
    va_end(args);
    return result;
  }
  </code></pre>
  <p>This feels error prone and hacky. Is there a way for <code>std::string</code> to be constructed from or operate on a <code>va_list</code> directly?</p>
  <blockquote>
  <p><em><strong>NOTE:</strong> The main problem I have with the solution above is the need to guess at the amount of memory I need. I don't want to waste too much or not have enough. Ideally, I would like a <code>std::string</code> style opaque allocation that just works.</em></p>
  <p><em><strong>NOTE:</strong> I need a solution that does not require third party library support.</em></p>
  </blockquote>