【发布时间】:2019-09-22 18:41:07
【问题描述】:
我需要在 ZMQ 套接字上发送一个对象(用 GPB 序列化)。目前该代码有一个额外的副本。如何直接将序列化数组写入message_ts 数据?
ABT_CommunicationProtocol introPacket;
// Fill the packet
message_t introMessage;
size_t dataLenght = introPacket.ByteSize();
char* temp = new char[dataLenght];
introPacket.SerializeToArray(temp, dataLenght); // write data to temp
memcpy(introMessage.data(), temp, dataLenght); // copy data to message
this->serverRquest.send(introMessage);
【问题讨论】:
标签: c++ protocol-buffers zeromq