-
Notifications
You must be signed in to change notification settings - Fork 813
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add woc::AutoCF<T>. It's like AutoId<T> for CFTypes.
Just like AutoId<T>, it takes a lifetime trait template: CFLifetimeRetain for CFRetain/CFRelease, and CFLifetimeUnsafe for straight assignment. It builds upon and replaces woc::unique_cf<T>. * It is copyable (and can share ownership) * AutoCF<T> can be passed anywhere T* is required. * It has a fully-loaded operator& so you can pass it wherever a T** is required. The old value will be released. * It has counterparts in StrongCF and UnsafeCF, just like StrongId and UnsafeId. By default, a StrongCF will *share ownership* of a CFType. To transfer ownership, construct it with std::move(cf) or use woc::MakeStrongCF<T>(CFCreateXxx(...)). As a migration measure, woc::unique_cf is still provided, though it is now based on StrongCF. It retains its "transfer ownership on construct" semantics and provides a few shim methods to adapt it to the AutoCF/AutoID world (release -> detach, reset -> attach).
- Loading branch information
Showing
4 changed files
with
405 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.