我正在尝试使用第 3 方库中的函数,并期望在其中传输二进制文件数据的输入流对象。
签名看起来像这样:
doSomething(const std::string& ...,
const std::string& ...,
std::istream& aData,
const std::string& ...,
const std::map<std::string, std::string>* ...,
long ...,
bool ...);
Since I can't alter/change this 3rd party lib/function, I have to adapt in "my" code. In the calling place, I have a std::vector which contains the data which is expected to be passed in an istream object. Currently I copy the vector to the stream, by iterating over it and using the << operator to copy byte by byte.
I strongly suspect that there might be a more effective/convenient way but couldn't find anything useful up to now. Any help/your thoughts are greatly appreciated.
Best, JR