c++ - 如何将原始数据附加到 boost::shared_array<char>?

标签 c++ boost shared-ptr

我有:

message->data = boost::shared_array<char>(new char[100]);

里面充满了数据。

我收到了int length的新char * data(来自旧的C API)。我想用新数据扩展数组,这意味着在 message->data 结束后写入新 data 的拷贝。

如何做这样的事情?

最佳答案

为什么不shared_ptr<vector<char> >

关于c++ - 如何将原始数据附加到 boost::shared_array<char>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14015223/

相关文章:

c++ - operator<< with boost::variant 是如何实现的

c++ - make_shared<>() 中的 WKWYL 优化是否会为某些多线程应用程序引入惩罚?

c++ - 通过 protected 构造函数和静态成员函数强制使用 std::shared_ptr 以创建实例和 std::make_shared

c++ - boost Python 可移植性问题

c++ - 如何在两组上做双指针技术

C++ and,or,not,xor 关键字

c++ - 为什么我可以将 boost map_list_of 传递给接受映射而不是构造函数的函数?

c++ - 如果未读取输出端点抛出无效参数

c++ - 在函数声明中推导 shared_ptr T

c++ - 数组到变量