[Solved] No matching function call for ostringstream `.str()`


When you do

writeSite(body.str(), "application/json");

the string object returned by body.str() is temporary. And non-constant references can not bind to temporary objects.

A simple solution is to make the site argument const just like you have done for the contentType argument (which would otherwise suffer from the same problem).

solved No matching function call for ostringstream `.str()`