Namespace for all functionality of the ADTF UCOM SDK provided since v3.21.
template<typename Implementation, bool Fuse, typename Allocator, typename... Args>
| object_ptr< Implementation > adtf::ucom::vision::allocate_object_ptr |
( |
Allocator && | allocator, |
|
|
Args &&... | args ) |
|
inline |
Create an instance of type object_ptr with Implementation as the shared resource.
allocate_object_ptr can be used in complete analogy to std::allocate_shared - to create an object of type object_ptr without the need to explicitly call new to allocate the shared resource. In fact, this function is the only valid way to create an object_ptr with a new shared resource.
- Template Parameters
-
| Implementation | Type of the shared resource which is created using the specified allocator. |
| Fuse | Enable fused allocations of control block and shared resource. |
| Allocator | Type of the allocator to be used for both control block and the shared resource. |
| Args | Parameter pack forwarded to the constructor of Implementation during instantiation. |
- Parameters
-
| [in] | allocator | Reference to an instance of Allocator that will be rebound as needed. |
| [in] | args | Parameters forwared to the constructor of Implementation during instantiation. |
- Note
- Due to the provided aliasing constructor in object_ptr, any created
object_ptr with a concrete implementation of IObject can be implicitly converted to an object_ptr managing a pointer to an interface of this concrete implementation.
- Return values
-
| On | success, the instance contains a newly allocated, reference counted object of type Implementation |
- Exceptions
-
| ... | On failure, the original exception is thrown. |
- See also
- ssection_ucom_reference_counting_creation