Boost logo

Boost :

Subject: [boost] [endian] swap_in_place use case
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2010-06-03 14:05:52


Hi,

I'm looking for a use case where the use of swap_in_place (or whatever is renamed) is not followed/preceded by a copy.

When I need to send a message I need to copy the information to send in a buffer. I gues that in this case the use of swap (copy) is the function to use.

Can somene help me to identify a real use case on which the swap_in_place can be used to send a message that do not need to be initialized before sending?

When I receive a message, I will need to store some of the messages information on application context, store them on local variables or pass them to other functions. All this suppose a copy from the buffer to the different kinds of native storage. I gues that swap (copy) should be used in this case also.

The example of Terry reveives a array of ints and makes a swap_in_place, but do nothing with. Someone has proposed to sum all these ints, but in this case, we don't need to swap_in_place and the count. With swap approach, we can count at the same time as we do the conversion, so no need to swap in place.

Can somene help me to identify a real use case on which the swap_in_place can be used to reveive a message, without needing to do any additional copy from the swapped buffer to native data?

Thanks,
_____________________
Vicente Juan Botet Escribá
http://viboes.blogspot.com/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk