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...")
 
 
Line 1: Line 1:
<div class="mw-parser-output">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.</div> <div class="mw-parser-output">&nbsp;</div> <div class="mw-parser-output">CXAutoReference<T> is designed to act in a manner syntactically equivalent&nbsp;to T* where possible.</div>  
+
<div class="mw-parser-output"><div class="mw-parser-output">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.</div> <div class="mw-parser-output">&nbsp;</div> <div class="mw-parser-output">''CXAutoReference<T>'' is designed to act in a manner syntactically equivalent&nbsp;to ''T*'' where possible.</div>  
 
= Restrictions =
 
= Restrictions =
 
<div class="mw-parser-output">Performance</div> <div class="mw-parser-output">Reference Cycles</div> <div class="mw-parser-output">Thread Safety</div> <div class="mw-parser-output">Conversion to C&nbsp;pointer</div> <div class="mw-parser-output">Stack-Allocated Objects</div> <div class="mw-parser-output">&nbsp;</div>  
 
<div class="mw-parser-output">Performance</div> <div class="mw-parser-output">Reference Cycles</div> <div class="mw-parser-output">Thread Safety</div> <div class="mw-parser-output">Conversion to C&nbsp;pointer</div> <div class="mw-parser-output">Stack-Allocated Objects</div> <div class="mw-parser-output">&nbsp;</div>  
 
= Techniques =
 
= Techniques =
<div class="mw-parser-output">Allocation / Swallow / Reference</div> <div class="mw-parser-output">Zero-Reference Cache</div> <div class="mw-parser-output">Passing by const reference</div> <div class="mw-parser-output">Move operator <div class="mw-parser-output">Casting</div> <div class="mw-parser-output">std::swap</div> </div> <div class="mw-parser-output">&nbsp;</div> <div class="mw-parser-output">&nbsp;</div>
+
<div class="mw-parser-output">Allocation / Swallow / Reference</div> <div class="mw-parser-output">Zero-Reference Cache</div> <div class="mw-parser-output">Passing by const reference</div> <div class="mw-parser-output">Move operator <div class="mw-parser-output">Casting</div> <div class="mw-parser-output">std::swap</div> </div> <div class="mw-parser-output">&nbsp;</div> <div class="mw-parser-output">&nbsp;</div> </div>

Latest revision as of 06:15, 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