Function opt_ref

Summary

#include <include/type_safe/optional_ref.hpp>

(1) template <typename T>
    optional_ref< T > opt_ref(const object_ref< T > &ref) noexcept

(2) template <typename T, typename = typename std::enable_if<!std::is_pointer<T>::value>::type>
    optional_ref< T > opt_ref(T &ref) noexcept

(3) template <typename T>
    optional_ref< T > opt_ref(optional< T > &opt) noexcept

(4) template <typename T>
    optional_ref< T > opt_ref(T *ptr) noexcept

Function overload

Synopsis

#include <include/type_safe/optional_ref.hpp>

template <typename T>
optional_ref< T > opt_ref(const object_ref< T > &ref) noexcept

Description

Returns
A [ts::optional_ref]() to the same target as ref. \module optional

Mentioned in

Source

Lines 166-170 in include/type_safe/optional_ref.hpp.

template <typename T>
optional_ref<T> opt_ref(const object_ref<T>& ref) noexcept
{
    return optional_ref<T>(ref.get());
}

Synopsis

#include <include/type_safe/optional_ref.hpp>

template <typename T, typename = typename std::enable_if<!std::is_pointer<T>::value>::type>
optional_ref< T > opt_ref(T &ref) noexcept

Description

Returns
A [ts::optional_ref]() to the given object. \module optional
Parameters

1 - \exclude

Mentioned in

Source

Lines 184-188 in include/type_safe/optional_ref.hpp.

template <typename T, typename = typename std::enable_if<!std::is_pointer<T>::value>::type>
optional_ref<T> opt_ref(T& ref) noexcept
{
    return optional_ref<T>(ref);
}

Synopsis

#include <include/type_safe/optional_ref.hpp>

template <typename T>
optional_ref< T > opt_ref(optional< T > &opt) noexcept

Description

Returns
A [ts::optional_ref]() to the stored value in opt. \module optional

Mentioned in

Source

Lines 202-206 in include/type_safe/optional_ref.hpp.

template <typename T>
optional_ref<T> opt_ref(optional<T>& opt) noexcept
{
    return opt ? optional_ref<T>(opt.value()) : nullopt;
}

Synopsis

#include <include/type_safe/optional_ref.hpp>

template <typename T>
optional_ref< T > opt_ref(T *ptr) noexcept

Description

Returns
A [ts::optional_ref<T>]() to the pointee of ptr or nullopt. \module optional

Mentioned in

Source

Lines 218-222 in include/type_safe/optional_ref.hpp.

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





Add Discussion as Guest

Log in