Hi Jonathan,

A user sent me this example:

float *tmp = new float[nx*ny];
string stmp(tmp,nx*ny*sizeof(float));
message.setData(stmp);

He had questions about deep versus shallow copies. I'll look at the docs.

William

----- "Jonathan Robie" <[EMAIL PROTECTED]> wrote:

> Danushka Menikkumbura wrote:
> > As far as I can see, this is wrong due to 3 reasons.
> >
> > 1. You can not resize "data" since it is a const.
> > 2. Resizing a string is costly.
> > 3. Copying stuff in to "data" alone is not sufficient as it is 
> > necessary to set the content length in the header as well.
> 
> Hmmmm, that's too bad. I'd like to avoid creating a buffer and then 
> copying it over ("minimize the movement of data"). Is there a better
> way 
> to write binary data directly into the message contents without
> creating 
> a buffer first?
> 
> Jonathan

Reply via email to