OpenSiv3D  v0.6.5
C++20 framework for creative coding
s3d::Optional< Type > Class Template Reference

Optional. More...

#include <Optional.hpp>

Inherits optional< Type >.

Public Types

using base_type = std::optional< Type >
 
using value_type = Type
 Optional が持つ値の型 More...
 

Public Member Functions

SIV3D_NODISCARD_CXX20 Optional ()=default
 
constexpr SIV3D_NODISCARD_CXX20 Optional (None_t)
 
SIV3D_NODISCARD_CXX20 Optional (const Optional &other)=default
 
Optionaloperator= (None_t) noexcept
 
constexpr Optionaloperator= (const Optional &other)
 
constexpr Optionaloperator= (Optional &&other) noexcept(std::is_nothrow_move_assignable_v< Type > &&std::is_nothrow_move_constructible_v< Type >)
 
template<class U = Type>
Optionaloperator= (U &&value)
 
template<class U >
Optionaloperator= (const Optional< U > &other)
 
template<class U >
Optionaloperator= (Optional< U > &&other)
 
void swap (Optional &other) noexcept(std::is_nothrow_move_constructible_v< Type > &&std::is_nothrow_swappable_v< Type >)
 
template<class... Args, std::enable_if_t< std::conjunction_v< std::is_copy_constructible< Type >, std::is_constructible< Type, Args... >>> * = nullptr>
constexpr value_type value_or_construct (Args &&... args) const &
 
template<class... Args, std::enable_if_t< std::conjunction_v< std::is_move_constructible< Type >, std::is_constructible< Type, Args... >>> * = nullptr>
constexpr value_type value_or_construct (Args &&... args) &&
 
template<class Fty , std::enable_if_t< std::conjunction_v< std::is_copy_constructible< Type >, std::is_convertible< std::invoke_result_t< Fty >, Type >>> * = nullptr>
constexpr value_type value_or_eval (Fty &&f) const &
 
template<class Fty , std::enable_if_t< std::conjunction_v< std::is_move_constructible< Type >, std::is_convertible< std::invoke_result_t< Fty >, Type >>> * = nullptr>
constexpr value_type value_or_eval (Fty &&f) &&
 
template<class Fty , std::enable_if_t< std::is_invocable_v< Fty, value_type & >> * = nullptr>
constexpr void then (Fty &&f)
 
template<class Fty , std::enable_if_t< std::is_invocable_v< Fty, value_type >> * = nullptr>
constexpr void then (Fty &&f) const
 
template<class Fty , class R = std::decay_t<std::invoke_result_t<Fty, value_type&>>>
Optional< R > map (Fty f)
 
template<class Fty , class R = std::decay_t<std::invoke_result_t<Fty, value_type>>>
Optional< R > map (Fty f) const
 

Friends

template<class CharType >
std::basic_ostream< CharType > & operator<< (std::basic_ostream< CharType > &output, const Optional< Type > &value)
 
void Formatter (FormatData &formatData, const Optional &value)
 

Detailed Description

template<class Type>
class s3d::Optional< Type >

Optional.

Template Parameters
TypeOptional が持つ値の型

Member Typedef Documentation

◆ base_type

template<class Type >
using s3d::Optional< Type >::base_type = std::optional<Type>

◆ value_type

template<class Type >
using s3d::Optional< Type >::value_type = Type

Optional が持つ値の型

Constructor & Destructor Documentation

◆ Optional() [1/3]

template<class Type >
SIV3D_NODISCARD_CXX20 s3d::Optional< Type >::Optional ( )
default

◆ Optional() [2/3]

template<class Type >
constexpr SIV3D_NODISCARD_CXX20 s3d::Optional< Type >::Optional ( None_t  )
constexpr

◆ Optional() [3/3]

template<class Type >
SIV3D_NODISCARD_CXX20 s3d::Optional< Type >::Optional ( const Optional< Type > &  other)
default

Member Function Documentation

◆ map() [1/2]

template<class Type >
template<class Fty , class R = std::decay_t<std::invoke_result_t<Fty, value_type&>>>
Optional<R> s3d::Optional< Type >::map ( Fty  f)

◆ map() [2/2]

template<class Type >
template<class Fty , class R = std::decay_t<std::invoke_result_t<Fty, value_type>>>
Optional<R> s3d::Optional< Type >::map ( Fty  f) const

◆ operator=() [1/6]

template<class Type >
constexpr Optional& s3d::Optional< Type >::operator= ( const Optional< Type > &  other)
constexpr

◆ operator=() [2/6]

template<class Type >
template<class U >
Optional& s3d::Optional< Type >::operator= ( const Optional< U > &  other)

◆ operator=() [3/6]

template<class Type >
Optional& s3d::Optional< Type >::operator= ( None_t  )
noexcept

◆ operator=() [4/6]

template<class Type >
constexpr Optional& s3d::Optional< Type >::operator= ( Optional< Type > &&  other) const &&
constexprnoexcept

◆ operator=() [5/6]

template<class Type >
template<class U >
Optional& s3d::Optional< Type >::operator= ( Optional< U > &&  other)

◆ operator=() [6/6]

template<class Type >
template<class U = Type>
Optional& s3d::Optional< Type >::operator= ( U &&  value)

◆ swap()

template<class Type >
void s3d::Optional< Type >::swap ( Optional< Type > &  other) const &&
noexcept

◆ then() [1/2]

template<class Type >
template<class Fty , std::enable_if_t< std::is_invocable_v< Fty, value_type & >> * = nullptr>
constexpr void s3d::Optional< Type >::then ( Fty &&  f)
constexpr

◆ then() [2/2]

template<class Type >
template<class Fty , std::enable_if_t< std::is_invocable_v< Fty, value_type >> * = nullptr>
constexpr void s3d::Optional< Type >::then ( Fty &&  f) const
constexpr

◆ value_or_construct() [1/2]

template<class Type >
template<class... Args, std::enable_if_t< std::conjunction_v< std::is_move_constructible< Type >, std::is_constructible< Type, Args... >>> * = nullptr>
constexpr value_type s3d::Optional< Type >::value_or_construct ( Args &&...  args) &&
constexpr

◆ value_or_construct() [2/2]

template<class Type >
template<class... Args, std::enable_if_t< std::conjunction_v< std::is_copy_constructible< Type >, std::is_constructible< Type, Args... >>> * = nullptr>
constexpr value_type s3d::Optional< Type >::value_or_construct ( Args &&...  args) const &
constexpr

◆ value_or_eval() [1/2]

template<class Type >
template<class Fty , std::enable_if_t< std::conjunction_v< std::is_move_constructible< Type >, std::is_convertible< std::invoke_result_t< Fty >, Type >>> * = nullptr>
constexpr value_type s3d::Optional< Type >::value_or_eval ( Fty &&  f) &&
constexpr

◆ value_or_eval() [2/2]

template<class Type >
template<class Fty , std::enable_if_t< std::conjunction_v< std::is_copy_constructible< Type >, std::is_convertible< std::invoke_result_t< Fty >, Type >>> * = nullptr>
constexpr value_type s3d::Optional< Type >::value_or_eval ( Fty &&  f) const &
constexpr

Friends And Related Function Documentation

◆ Formatter

template<class Type >
void Formatter ( FormatData formatData,
const Optional< Type > &  value 
)
friend

◆ operator<<

template<class Type >
template<class CharType >
std::basic_ostream<CharType>& operator<< ( std::basic_ostream< CharType > &  output,
const Optional< Type > &  value 
)
friend

The documentation for this class was generated from the following file: