VCCC  2024.05
VisualCamp Common C++ library
optional< T > Class Template Reference

#include </home/jarvis/actions-runner/jarvis-vccc-2/_work/vccc/vccc/include/vccc/__optional/optional.h>

+ Inheritance diagram for optional< T >:

Detailed Description

template<typename T>
class vccc::optional< T >

See std::optional for more information

Template Parameters
T

Public Types

using value_type = T
 

Public Member Functions

constexpr operator bool () const noexcept
 
constexpr bool has_value () const noexcept
 
void swap (optional &other) noexcept(std::is_nothrow_move_constructible< value_type >::value &&vccc::is_nothrow_swappable< value_type >::value)
 
(constructor)
constexpr optional () noexcept=default
 
constexpr optional (nullopt_t) noexcept
 
constexpr optional (const optional &other)=default
 
constexpr optional (optional &&other)=default
 
template<typename U , std::enable_if_t< std::is_constructible< value_type, const U & >::value &&internal::optional::check_constructible< value_type, optional< U >>::value &&internal::optional::check_convertible< value_type, optional< U >>::value, int > = 0>
constexpr optional (const optional< U > &other)
 
template<typename U , std::enable_if_t< std::is_constructible< value_type, const U & >::value &&internal::optional::check_constructible< value_type, optional< U >>::value &&internal::optional::check_convertible< value_type, optional< U >>::value &&!std::is_convertible< const U &, value_type >::value, int > = 0>
constexpr optional (const optional< U > &other)
 
template<typename U , std::enable_if_t< std::is_constructible< value_type, U && >::value &&internal::optional::check_constructible< value_type, optional< U >>::value &&internal::optional::check_convertible< value_type, optional< U >>::value, int > = 0>
constexpr optional (optional< U > &&other)
 
template<typename U , std::enable_if_t< std::is_constructible< value_type, U && >::value &&internal::optional::check_constructible< value_type, optional< U >>::value &&internal::optional::check_convertible< value_type, optional< U >>::value &&!std::is_convertible< U &&, value_type >::value, int > = 0>
constexpr optional (optional< U > &&other)
 
template<typename InPlaceT , std::enable_if_t< std::is_same< InPlaceT, in_place_t >::value &&std::is_constructible< value_type >::value, int > = 0>
constexpr optional (InPlaceT)
 
template<typename Arg , typename ... Args, std::enable_if_t< std::is_constructible< value_type, Arg, Args... >::value, int > = 0>
constexpr optional (in_place_t, Arg &&arg, Args &&... args)
 
template<typename U , typename ... Args, std::enable_if_t< std::is_constructible< value_type, std::initializer_list< U > &, Args &&... >::value, int > = 0>
constexpr optional (in_place_t, std::initializer_list< U > ilist, Args &&... args)
 
template<typename U = value_type, std::enable_if_t< std::is_constructible< value_type, U && >::value &&std::is_convertible< U &&, value_type >::value &&!std::is_same< internal::optional::strip_t< U >, in_place_t >::value &&!std::is_same< internal::optional::strip_t< U >, optional< value_type >>::value, int > = 0>
constexpr optional (U &&value)
 
template<typename U = value_type, std::enable_if_t< std::is_constructible< value_type, U && >::value &&!std::is_convertible< U &&, value_type >::value &&!std::is_same< internal::optional::strip_t< U >, in_place_t >::value &&!std::is_same< internal::optional::strip_t< U >, optional< value_type >>::value, int > = 0>
constexpr optional (U &&value)
 
operator=
optionaloperator= (nullopt_t) noexcept
 
constexpr optionaloperator= (optional const &)=default
 
constexpr optionaloperator= (optional &&)=default
 
template<typename U , std::enable_if_t<(std::is_constructible< value_type, U >::value &&std::is_assignable< value_type &, U >::value &&!std::is_same< internal::optional::strip_t< U >, optional >::value) &&(!std::is_scalar< value_type >::value||!std::is_same< std::decay_t< U >, value_type >::value), int > = 0>
optionaloperator= (U &&value)
 
template<typename U , std::enable_if_t< internal::optional::check_constructible< value_type, optional< U >>::value &&internal::optional::check_convertible< value_type, optional< U >>::value &&internal::optional::check_assignable< value_type, optional< U >>::value &&std::is_constructible< value_type, const U & >::value &&std::is_assignable< value_type &, const U & >::value, int > = 0>
optionaloperator= (const optional< U > &other)
 
template<typename U , std::enable_if_t< internal::optional::check_constructible< value_type, optional< U >>::value &&internal::optional::check_convertible< value_type, optional< U >>::value &&internal::optional::check_assignable< value_type, optional< U >>::value &&std::is_constructible< value_type, U >::value &&std::is_assignable< value_type &, U >::value, int > = 0>
optionaloperator= (optional< U > &&other)
 
operator->
constexpr const value_typeoperator-> () const noexcept
 
constexpr value_typeoperator-> () noexcept
 
operator*
constexpr const value_typeoperator* () const &noexcept
 
constexpr value_typeoperator* () &noexcept
 
constexpr const value_type && operator* () const &&noexcept
 
constexpr value_type && operator* () &&noexcept
 
value
constexpr value_typevalue () &
 
constexpr const value_typevalue () const &
 
constexpr value_type && value () &&
 
constexpr const value_type && value () const &&
 
value_or
template<typename U >
constexpr value_type value_or (U &&default_value) const &
 
template<typename U >
constexpr value_type value_or (U &&default_value) &&
 
and_then
template<typename F , std::enable_if_t< is_specialization< invoke_result_t< F, value_type & >, optional >::value, int > = 0>
constexpr auto and_then (F &&f) &
 
template<typename F , std::enable_if_t< is_specialization< invoke_result_t< F, const value_type & >, optional >::value, int > = 0>
constexpr auto and_then (F &&f) const &
 
template<typename F , std::enable_if_t< is_specialization< invoke_result_t< F, value_type && >, optional >::value, int > = 0>
constexpr auto and_then (F &&f) &&
 
template<typename F , std::enable_if_t< is_specialization< invoke_result_t< F, const value_type && >, optional >::value, int > = 0>
constexpr auto and_then (F &&f) const &&
 
transform
template<typename F , std::enable_if_t< is_invocable< F, value_type & >::value, int > = 0>
constexpr auto transform (F &&f) &
 
template<typename F , std::enable_if_t< is_invocable< F, const value_type & >::value, int > = 0>
constexpr auto transform (F &&f) const &
 
template<typename F , std::enable_if_t< is_invocable< F, value_type & >::value, int > = 0>
constexpr auto transform (F &&f) &&
 
template<typename F , std::enable_if_t< is_invocable< F, value_type & >::value, int > = 0>
constexpr auto transform (F &&f) const &&
 
or_else
template<typename F , std::enable_if_t< conjunction< copy_constructible< T >, invocable< F > >::value, int > = 0>
constexpr optional or_else (F &&f) const &
 
template<typename F , std::enable_if_t< conjunction< move_constructible< T >, invocable< F > >::value, int > = 0>
constexpr optional or_else (F &&f) &&
 
emplace
template<typename Dummy = void, std::enable_if_t< std::is_same< Dummy, void >::value &&std::is_constructible< value_type >::value, int > = 0>
value_typeemplace ()
 
template<typename Arg , typename ... Args, std::enable_if_t< std::is_constructible< value_type, Arg, Args... >::value, int > = 0>
value_typeemplace (Arg &&arg, Args &&... args)
 
template<typename U , typename ... Args, std::enable_if_t< std::is_constructible< value_type, std::initializer_list< U > &, Args &&... >::value, int > = 0>
value_typeemplace (std::initializer_list< U > ilist, Args &&... args)
 

Member Typedef Documentation

◆ value_type

using value_type = T

Constructor & Destructor Documentation

◆ optional() [1/13]

constexpr optional ( )
constexprdefaultnoexcept

◆ optional() [2/13]

constexpr optional ( nullopt_t  )
inlineconstexprnoexcept

◆ optional() [3/13]

constexpr optional ( const optional< T > &  other)
constexprdefault

◆ optional() [4/13]

constexpr optional ( optional< T > &&  other)
constexprdefault

◆ optional() [5/13]

constexpr optional ( const optional< U > &  other)
inlineconstexpr

◆ optional() [6/13]

constexpr optional ( const optional< U > &  other)
inlineexplicitconstexpr

◆ optional() [7/13]

constexpr optional ( optional< U > &&  other)
inlineconstexpr

◆ optional() [8/13]

constexpr optional ( optional< U > &&  other)
inlineexplicitconstexpr

◆ optional() [9/13]

constexpr optional ( InPlaceT  )
inlineexplicitconstexpr

◆ optional() [10/13]

constexpr optional ( in_place_t  ,
Arg &&  arg,
Args &&...  args 
)
inlineexplicitconstexpr

◆ optional() [11/13]

constexpr optional ( in_place_t  ,
std::initializer_list< U >  ilist,
Args &&...  args 
)
inlineexplicitconstexpr

◆ optional() [12/13]

constexpr optional ( U &&  value)
inlineconstexpr

◆ optional() [13/13]

constexpr optional ( U &&  value)
inlineexplicitconstexpr

Member Function Documentation

◆ and_then() [1/4]

constexpr auto and_then ( F &&  f) &
inlineconstexpr

◆ and_then() [2/4]

constexpr auto and_then ( F &&  f) &&
inlineconstexpr

◆ and_then() [3/4]

constexpr auto and_then ( F &&  f) const &
inlineconstexpr

◆ and_then() [4/4]

constexpr auto and_then ( F &&  f) const &&
inlineconstexpr

◆ emplace() [1/3]

value_type& emplace ( )
inline

◆ emplace() [2/3]

value_type& emplace ( Arg &&  arg,
Args &&...  args 
)
inline

◆ emplace() [3/3]

value_type& emplace ( std::initializer_list< U >  ilist,
Args &&...  args 
)
inline

◆ has_value()

constexpr bool has_value ( ) const
inlineconstexprnoexcept

◆ operator bool()

constexpr operator bool ( ) const
inlineexplicitconstexprnoexcept

◆ operator*() [1/4]

constexpr value_type&& operator* ( ) &&
inlineconstexprnoexcept

◆ operator*() [2/4]

constexpr value_type& operator* ( ) &
inlineconstexprnoexcept

◆ operator*() [3/4]

constexpr const value_type&& operator* ( ) const &&
inlineconstexprnoexcept

◆ operator*() [4/4]

constexpr const value_type& operator* ( ) const &
inlineconstexprnoexcept

◆ operator->() [1/2]

constexpr const value_type* operator-> ( ) const
inlineconstexprnoexcept

◆ operator->() [2/2]

constexpr value_type* operator-> ( )
inlineconstexprnoexcept

◆ operator=() [1/6]

optional& operator= ( const optional< U > &  other)
inline

◆ operator=() [2/6]

optional& operator= ( nullopt_t  )
inlinenoexcept

◆ operator=() [3/6]

constexpr optional& operator= ( optional< T > &&  )
constexprdefault

◆ operator=() [4/6]

constexpr optional& operator= ( optional< T > const &  )
constexprdefault

◆ operator=() [5/6]

optional& operator= ( optional< U > &&  other)
inline

◆ operator=() [6/6]

optional& operator= ( U &&  value)
inline

◆ or_else() [1/2]

constexpr optional or_else ( F &&  f) &&
inlineconstexpr

◆ or_else() [2/2]

constexpr optional or_else ( F &&  f) const &
inlineconstexpr

◆ swap()

void swap ( optional< T > &  other)
inlinenoexcept

◆ transform() [1/4]

constexpr auto transform ( F &&  f) &
inlineconstexpr

◆ transform() [2/4]

constexpr auto transform ( F &&  f) &&
inlineconstexpr

◆ transform() [3/4]

constexpr auto transform ( F &&  f) const &
inlineconstexpr

◆ transform() [4/4]

constexpr auto transform ( F &&  f) const &&
inlineconstexpr

◆ value() [1/4]

constexpr value_type& value ( ) &
inlineconstexpr

◆ value() [2/4]

constexpr value_type&& value ( ) &&
inlineconstexpr

◆ value() [3/4]

constexpr const value_type& value ( ) const &
inlineconstexpr

◆ value() [4/4]

constexpr const value_type&& value ( ) const &&
inlineconstexpr

◆ value_or() [1/2]

constexpr value_type value_or ( U &&  default_value) &&
inlineconstexpr

◆ value_or() [2/2]

constexpr value_type value_or ( U &&  default_value) const &
inlineconstexpr

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