Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ACC7C9C12 for ; Mon, 13 Feb 2012 15:07:20 +0000 (UTC) Received: (qmail 41878 invoked by uid 500); 13 Feb 2012 15:07:20 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 41692 invoked by uid 500); 13 Feb 2012 15:07:19 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 41644 invoked by uid 99); 13 Feb 2012 15:07:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Feb 2012 15:07:18 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=SPF_SOFTFAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of stephen@ju-ju.com does not designate 216.139.236.26 as permitted sender) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Feb 2012 15:07:13 +0000 Received: from joe.nabble.com ([192.168.236.139]) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1RwxUS-0001UU-I8 for users@activemq.apache.org; Mon, 13 Feb 2012 07:06:52 -0800 Date: Mon, 13 Feb 2012 07:06:52 -0800 (PST) From: stephenju To: users@activemq.apache.org Message-ID: <1329145612552-4384039.post@n4.nabble.com> Subject: ActiveMQ CPP: Getting text from a Text Message without making temporary MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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.