Open
Description
I'm trying to pin a message_t in a way I can use it later for zero copy and I'm having a bear of a time doing it. In the below test the first one passes and the second one fails. I would have expected them both to pass since the underlying data isn't being memcpy'd anywhere. I can go with the first message, but its a bit unexpected to me that the first one fails.
TEST(ZMQTests, BUG)
{
{
zmq::multipart_t test;
test.pushstr("echo2");
zmq::multipart_t message;
std::string_view view;
zmq::message_t foo = test.pop();
view = {static_cast<char*>(foo.data()), foo.size()};
message = std::move(foo);
EXPECT_EQ(std::string("echo2"), view);
}
{
zmq::multipart_t test;
test.pushstr("echo2");
zmq::message_t message;
std::string_view view;
zmq::message_t foo = test.pop();
view = {static_cast<char*>(foo.data()), foo.size()};
message = std::move(foo);
EXPECT_EQ(std::string("echo2"), view);
}
}
Metadata
Metadata
Assignees
Labels
No labels