Is it possible to pass a stringstream as a function parameter?

c++, function, parameter-passing, stringstream

Solution

Sure thing. Why wouldn't it be? Example declaration of such function:

void my_func(std::ostringstream& ss);

Problem

Is it possible to pass in a stringstream and have the function write to it directly? I remember I saw a function invoked similar to something like this: ``` my_func(ss << "text" << hex << 33); ```

Original source