Difference between revisions of "CXAutoReferenceNew"

From cxwiki

(Created page with "<div class="mw-parser-output">The CXAutoReferenceNew templated class allows reference-counted objects to be instantiated and simultaneously placed into a CXAutoReferenceNoNull...")
(No difference)

Revision as of 06:03, 23 February 2018

The CXAutoReferenceNew templated class allows reference-counted objects to be instantiated and simultaneously placed into a CXAutoReferenceNoNull-derived storage. This provides a number of benefits over manual allocation, including:
  • The data type is guaranteed not null, simplifying development and slightly improving compiled code performance.
  • A reference-counted object can be constructed as a member of a parent object without extra construction syntax.
  • Construction syntax is simplified; eg.
    • Without: CXAutoReference<SomeObject> someObject = CXAutoReference<SomeObject>::Swallow(new SomObject(param0, param1));
    • With: CXAutoReferenceNew<SomeObject> someObject(param0, param1);