Function opt_xref

Summary

#include <include/type_safe/optional_ref.hpp>

(1) template <typename T>
    optional_xvalue_ref< T > opt_xref(T *ptr) noexcept

(2) template <typename T, typename = typename std::enable_if<!std::is_pointer<T>::value>::type>
    optional_xvalue_ref< T > opt_xref(T &obj) noexcept

Function overload

Synopsis

#include <include/type_safe/optional_ref.hpp>

template <typename T>
optional_xvalue_ref< T > opt_xref(T *ptr) noexcept

Description

Returns
A [ts::optional_xvalue_ref<T>]() to the pointee of ptr or nullopt. \notes The pointee will be moved from when you call value(). \module optional

Source

Lines 242-246 in include/type_safe/optional_ref.hpp.

template <typename T>
optional_xvalue_ref<T> opt_xref(T* ptr) noexcept
{
    return ptr ? optional_xvalue_ref<T>(*ptr) : nullopt;
}

Synopsis

#include <include/type_safe/optional_ref.hpp>

template <typename T, typename = typename std::enable_if<!std::is_pointer<T>::value>::type>
optional_xvalue_ref< T > opt_xref(T &obj) noexcept

Description

Returns
A [ts::optional_xvalue_ref<T>]() to the given object. \notes The pointee will be moved from when you call value(). \module optional
Parameters

1 - \exclude

Source

Lines 253-257 in include/type_safe/optional_ref.hpp.

template <typename T, typename = typename std::enable_if<!std::is_pointer<T>::value>::type>
optional_xvalue_ref<T> opt_xref(T& obj) noexcept
{
    return optional_xvalue_ref<T>(obj);
}





Add Discussion as Guest

Log in