BewareMyPower commented on pull request #13293:
URL: https://github.com/apache/pulsar/pull/13293#issuecomment-994245553
I have a suggestion for testing the memory copy doesn't occur after this
change, but it might depend on the implementation of `std::string`.
```c++
TEST(MessageBuilderTest, testSetContent) {
std::string value;
value.resize(1024, 'x');
const void* originalAddress = &value[0];
{
auto msg = MessageBuilder().setContent(value).build();
ASSERT_NE(msg.getData(), originalAddress);
}
{
auto msg = MessageBuilder().setContent(std::move(value)).build();
ASSERT_EQ(msg.getData(), originalAddress);
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]