Can I memcpy() any type which has a trivial destructor?

前端 未结 4 1149
感情败类
感情败类 2021-02-20 17:02

I do realize is_pod is a sufficient condition for a type to be memcpy-able, but is has_trivial_destructor also sufficien

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-20 17:32

    It seems to me that a class with a plain pointer would qualify as has_trivial_destructor, but you usually want to make a deep copy whereas memcpy would create a shallow copy.

提交回复
热议问题