voidify
Min standard notice:
Returns the address of obj (implicitly converted to void*).
# Declarations
template< class T >
void* voidify( T& obj ) noexcept;
(exposition only*) (constexpr since C++17)
# Parameters
obj: the object whose address will be taken
# Return value
&obj
# Notes
This exposition-only function is introduced by P0896R4. It is used to describe the effects of uninitialized memory algorithms which construct objects in uninitialized memory areas. The result pointer is used as the placement-params of a placement new expression.
Initially, the return value was const_cast<void*>(static_cast<const volatile void*>(std::addressof(obj))), which breaks const-correctness. The explicit casts were removed by the resolution of LWG issue 3870, and the only conversion left is the implicit conversion to void*.
# Defect reports
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 3870 | C++98 | the explicit casts broke const-correctness | removed these casts |
# See also
- uninitialized_copy
- ranges::uninitialized_copy
- uninitialized_fill
- ranges::uninitialized_fill
- uninitialized_move
- ranges::uninitialized_move
- uninitialized_default_construct
- default-initialization
- ranges::uninitialized_default_construct
- default-initialization
- uninitialized_value_construct
- value-initialization
- ranges::uninitialized_value_construct
- value-initialization
- construct_at
- ranges::construct_at