|
Boost : |
From: Edward Diener (eddielee_at_[hidden])
Date: 2003-08-26 07:02:43
Pavel Vozenilek wrote:
> "Edward Diener" <eddielee_at_[hidden]> wrote in message
> news:biedm2$dt8$1_at_sea.gmane.org...
>> Extremely dangerous and error prone. I can't even imagine a non-POD
>> type where flagging it for memcpy_copyable and memcpy_moveable can
>> be right.
> Can
>> you give an example ?
>>
> It is error prone but many other constructs are too.
>
> Example of moveable object:
>
> struct string_buffer {
> unsigned size;
> char* data; // allocated buffer
> };
According to my understanding, this is a POD type. It would be unnecessary
to flag this. But even for a POD type such as this, copying would lead to
errors if the char * data were dynamically allocated since a double delete
would probably be done. And adding a copy constructor to deal with it would
remove it from POD category and make your memcpy_copyable and
memcpy_moveable irrelevant for it.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk