CXAutoReferenceNew

From cxwiki

Revision as of 06:03, 23 February 2018 by Windwalkr (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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);