Difference between revisions of "CXAutoReferenceNoNull"
From cxwiki
(Created page with "<div class="mw-parser-output"> The CXAutoReferenceNoNull templated class allows reference-counted objects to be passed around while automatically maintaining the correct...") |
(No difference)
|
Latest revision as of 06:13, 23 February 2018
The CXAutoReferenceNoNull templated class allows reference-counted objects to be passed around while automatically maintaining the correct reference count. This is a very simple and powerful tool to use for resource management. The referenced object must expose a specific reference counting interface- typically this is achieved by inheriting from DynamicReferenceCount but other techniques are permitted.
CXAutoReferenceNoNull<T> is designed to act in a manner syntactically equivalent to T* __nonnull where possible.
CXAutoReferenceNoNull<T> is syntactically equivalent to CXAutoReference<T> with the exception that is not valid to assign a nullptr value. Where possible, this is enforced at compile time. Where not possible, runtime assertions are provided.