CXAutoReferenceNew
From cxwiki
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);
CXAutoReferenceNew<T> is designed to act in a manner syntactically equivalent to a T* __nonnull where possible.