Is there a way to access the text bytes without creating a temporary
std::string? I am dealing with some large text messages and try not to
allocate memory when making copies. For example, when I get the message:

std::string reply = myMessage->getText();

getText() makes a copy of its data on return. And the assignment operator
copies it again into my variable. If I can pass my std::string variable to
the message and have it fill it out for me, or I can get the constant
reference to the string data in the message, it will save considerable time
and memory.

There are also times that I don't need to make a copy of the text. Like when
parsing the text as XML or JSON, the data is no longer needed after the
parsed structure is created.

Thanks.

--
View this message in context: 
http://activemq.2283324.n4.nabble.com/ActiveMQ-CPP-Getting-text-from-a-Text-Message-without-making-temporary-tp4384039p4384039.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to