Quote from Effective Modern C++:
For std::unique_ptr, the type of the deleter is part of the
type of the smart pointer, and this makes it possible for compilers to generate
smaller runtime data structures and faster runtime code.
A consequence of this greater efficiency is that pointed-to types must be
complete when compiler generated special functions
(e.g., destructors or move operations) are used.
For std::shared_ptr, the type of the deleter is not part of the type of the smart
pointer. This necessitates larger runtime data structures and somewhat slower
code, but pointed-to types need not be complete when compiler-generated special
functions are employed.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.