Difference between revisions of "CXAutoReference"
From cxwiki
(Created page with "<div class="mw-parser-output">The CXAutoReference templated class allows reference-counted objects to be passed around while automatically maintaining the correct reference co...") |
(No difference)
|
Revision as of 05:55, 23 February 2018
The CXAutoReference 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.
CXAutoReference<T> is designed to act in a manner syntactically equivalent to T* where possible.
Restrictions
Performance
Reference Cycles
Thread Safety
Conversion to C pointer
Stack-Allocated Objects
Techniques
Allocation / Swallow / Reference
Zero-Reference Cache
Passing by const reference
Move operator
Casting
std::swap