uninit

The ztd::uninit type is for holding a type that may be initialized by-default into an uninitialized state (e.g., for C-style arrays that are a member of a class).

template<typename _Type>
class uninit

A class for holding a value inside of an unnamed union which is composed of two objects, one of char and one of _Type.

Public Functions

inline constexpr uninit()

Constructs an empty placeholder.

template<typename ..._Args>
inline constexpr uninit(::std::in_place_t, _Args&&... __args)

Constructs the value from the given arguments.

Parameters

__args[in] The arguments to construct value with.

inline ~uninit()

An empty destructor. Required, as there is a union object present.

Public Members

char placeholder

Placeholder empty value for default / empty initialization, esp. with arrays.

_Type value

Actual value.

Friends

inline friend _Type &unwrap(uninit &__wrapped_value) noexcept

Extension point for returning the value inside of this uninitialized type.

inline friend const _Type &unwrap(const uninit &__wrapped_value) noexcept

Extension point for returning the value inside of this uninitialized type.

inline friend _Type &&unwrap(uninit &&__wrapped_value) noexcept

Extension point for returning the value inside of this uninitialized type.