Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - CanDuplicate {dup} (~ has trivial copy constructor)
- You can duplicate a value of the type with memcpy.
- - CanDiscard {disc} (~ has trivial destructor)
- You can discard a value of the type (without invoking destructor)
- - CanRelocate {rel} (does not have a direct analogy)
- You can move a value to a new address with memcpy (discarding the old value in the process).
- Some examples:
- Primitive types are {dup, disc, rel}
- Unique ptr is {rel} (cannot be duplicated, must invoke code when discarded)
- Shared ptr is {rel} (must invoke code in duplication, must invoke code when discarded)
- Vector is {} (cannot be relocated because may hold a pointer to itself as part of SBO)
- Event listener {} (must register itself when duplicated, unregister when discarded, and update its registration when relocated)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement