Namespaces
Variants

std::out_ptr_t<Smart,Pointer,Args...>::operator Pointer*, std::out_ptr_t<Smart,Pointer,Args...>::operator void**

From cppreference.com
 
 
Memory management library
Allocators
Memory resources
Uninitialized storage (until C++20*)
Garbage collector support (until C++23)
 
 
operator Pointer*() const noexcept;
(1) (since C++23)
(constexpr since C++26)
operator void**() const noexcept;
(2) (since C++23)

Exposes the address of a Pointer or void* object to a foreign function which will generally re-initialize it.

1) Converts *this to the address of stored Pointer object.
If operator void**() has been called on *this, the behavior is undefined.
2) Converts *this to the address of a void* object.
This overload participates in overload resolution only if std::is_same_v<Pointer, void*> is false.
If std::is_pointer_v<Pointer> is false, the program is ill-formed.
Returns a pointer ptr satisfying all following conditions:
  • The initial value of *ptr is equivalent to the value of the stored Pointer object converted to void*.
  • Any modification of *ptr that is not followed by a subsequent modification of *this affects the Pointer value used in the destructor.
If operator Pointer*() has been called on *this, the behavior is undefined.
If *ptr is accessed outside the lifetime of *this, the behavior is undefined.

Return value

1) A pointer to the stored Pointer object.
2) A pointer to the void* object that satisfies aforementioned requirements.

Notes

If the object pointed by the return value has not been rewritten, it is equal to nullptr.

On common implementations, the object representation of every Pointer that is a pointer type is compatible with that of void*, and therefore these implementations typically store the void* object within the storage for the Pointer object, no additional storage needed:

  • If the implementation enables type-based alias analysis (which relies on the strict aliasing rule), a properly aligned std::byte[sizeof(void*)] member subobject may be used, and both conversion functions return the address of objects implicitly created within the array.
  • Otherwise, a Pointer member subobject may be used for both conversion functions, and operator void** may directly returns its address reinterpret_cast to void**.

If Pointer is a pointer type whose object representation is incompatible with that of void*, an additional bool flag may be needed for recording whether operator Pointer* (or operator void**) has been called.

Example

Morty Proxy This is a proxified and sanitized view of the page, visit original site.