"Edward Diener" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> 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
};

The user could then write:

template<> memcpy_moveable<string_buffer> {
  static bool moveable = true; // or defining some type or so
}

and container can detect moveability and use memcpy(). If type is not
flagged, memcpy() won't be used.

Usually strings, smart pointers, vectors, pimpls are memcpy moveable. Pimpl
with back pointer isn't.

(The memcpy_copyable<> is probably not that good idea and not much useful.)

/Pavel



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to