The actual value_type passed to the optional is ts::object_ref, but the reference types are normal references, so value() will return a T& and value_or() takes a fallback reference of the same type and returns one of them. Assigning an optional will always change the target of the reference. You cannot pass rvalues.

If XValue is true, you still cannot pass rvalues, but the result of value()/value_or() will return an rvalue reference, to allow moving of the stored value into something else.

Depending on the const-ness of T is the reference to const or non-const as well, unless XValue is true, in which caseTmust not beconst`.

Alias template type_safe::optional_xvalue_ref

A ts::basic_optional that uses ts::reference_optional_storage with XValue being true. It is an optional reference to an xvalue, i.e. an lvalue that can be moved from, like returned by std::move(). \notes T is the type without the reference, i.e. optional_xvalue_ref<int>. \module optional