Function opt_cref

Summary

#include <include/type_safe/optional_ref.hpp>

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

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

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

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

Function overload

Synopsis

#include <include/type_safe/optional_ref.hpp>

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

Description

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

Mentioned in

Source

Lines 174-178 in include/type_safe/optional_ref.hpp.

template <typename T>
optional_ref<const T> opt_cref(const object_ref<T>& ref) noexcept
{
    return optional_ref<const 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< const T > opt_cref(const T &ref) noexcept

Description

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

1 - \exclude

Mentioned in

Source

Lines 194-198 in include/type_safe/optional_ref.hpp.

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

Synopsis

#include <include/type_safe/optional_ref.hpp>

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

Description

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

Mentioned in

Source

Lines 210-214 in include/type_safe/optional_ref.hpp.

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

Synopsis

#include <include/type_safe/optional_ref.hpp>

template <typename T>
optional_ref< const T > opt_cref(const T *ptr) noexcept

Description

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

Mentioned in

Source

Lines 226-230 in include/type_safe/optional_ref.hpp.

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





Add Discussion as Guest

Log in