- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我遇到了 T 类型的值/对象表示的定义。 3.8/4 给了我们一个:
The object representation of an object of type T is the sequence of N unsigned char objects taken up by the object of type T, where N equals sizeof(T). The value representation of an object is the set of bits that hold the value of type T. For trivially copyable types, the value representation is a set of bits in the object representation that determines a value, which is one discrete element of an implementation-defined set of values.
我无法想象这些定义对于任何其他类型之间的普通可兼容类型的区别。什么特别的限制适用于平凡可复制的类型?我想看一个例子,如果有的话,这种区别。
最佳答案
如果一个对象不是一个简单的可复制对象,它可能必须进行一些资源初始化/清理(并且在非常低级的上下文中,这不仅简单而且可能依赖于固定地址)。
拥有两个认为它们都获得了硬件资源的不同对象是灾难的根源。
关于c++ - 平凡可复制的值表示与可能不可复制的值表示之间是否存在显着差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25830865/
我是一名优秀的程序员,十分优秀!