Function make_optional

Summary

#include <include/type_safe/optional.hpp>

(1) template <typename T>
    optional< typename std::decay< T >::type > make_optional(T &&t)

(2) template <typename T, typename... Args>
    optional< T > make_optional(Args &&... args)

Function overload

Synopsis

#include <include/type_safe/optional.hpp>

template <typename T>
optional< typename std::decay< T >::type > make_optional(T &&t)

Description

Returns
A new [ts::optional<T>]() storing a copy of t. \module optional

Mentioned in

Source

Lines 965-968 in include/type_safe/optional.hpp.

template <typename T>
optional<typename std::decay<T>::type> make_optional(T&& t)
{
    return std::forward<T>(t);

Synopsis

#include <include/type_safe/optional.hpp>

template <typename T, typename... Args>
optional< T > make_optional(Args &&... args)

Description

Returns
A new [ts::optional<T>]() with a value created by perfectly forwarding args to the constructor. \module optional

Mentioned in

Source

Lines 973-978 in include/type_safe/optional.hpp.

template <typename T, typename... Args>
optional<T> make_optional(Args&&... args)
{
    optional<T> result;
    result.emplace(std::forward<Args>(args)...);
    return result;





Add Discussion as Guest

Log in