From what I understand, a std::stringstream
is represented internally not as an std::string
but rather as a set of std::string
instances. (correct me if I am wrong).
I have data represented as an std::stringstream
and I want to pass it to a C function (clCreateProgramWithSource
from OpenCL) that expects the data as an array of arrays of chars. (const char**)
.
Is there some way to do this without first creating a single string that holds the entire content of the stringstream, for example in the following way:
std::string tmp1 = my_stringstream.str();
const char* tmp2 = tmp1.c_str();
const char** tmp3 = &tmp2;
EDIT
Follow-up question:
If this is not possible, is there some alternative to std::stringstream
, inheriting from std::ostream
, that allows this low level access?