writing directly to std::string internal buffers

前端 未结 9 1138
猫巷女王i
猫巷女王i 2020-11-29 07:22

I was looking for a way to stuff some data into a string across a DLL boundary. Because we use different compilers, all our dll interfaces are simple char*.

Is ther

9条回答
  •  借酒劲吻你
    2020-11-29 07:39

    The standard part of std::string is the API and the some of the behavior, not the memory layout of the implementation.

    Therefore if you're using different compilers you can't assume they are the same, so you'll need to transport the actual data. As others have said transport the chars and push into a new std::string.

提交回复
热议问题