I was coding with CppRESTsdk and got Concurrency::streams::istream
from the response body like the following code:
web::http::http_response localVarResponse;
auto concurrencyStream = localVarResponse.body();
I want to convert the stream to std::istream
and use it inside std::shared_ptr
so that I can pass it to other classes like this:
std::istream stdStream = concurrencyStream;
auto istream_ptr = std::make_shared<std::istream>(stdStream);
But I got errors:
E0312 no suitable user-defined conversion from
"Concurrency::streams::istream" to "std::istream" exists
How can I convert to std::istream
?
EDIT: indirectly via std::streambuf it works.
std::string str = localVarResponse.content_ready().get().extract_utf8string(true).get();
std::istringstream SStream(str);
std::istream inputStream(SStream.rdbuf());