Range-v3
Range algorithms, views, and actions for the Standard Library
ranges::v3::optional< T > Struct Template Reference
+ Inheritance diagram for ranges::v3::optional< T >:

Public Types

template<typename U >
using ShouldConvert = meta::not_< meta::or_< Constructible< T, optional< U > &>, Constructible< T, optional< U > &&>, Constructible< T, optional< U > const &>, Constructible< T, optional< U > const && >, ConvertibleTo< optional< U > &, T >, ConvertibleTo< optional< U > &&, T >, ConvertibleTo< optional< U > const &, T >, ConvertibleTo< optional< U > const &&, T > >>
 
template<typename U >
using ShouldConvertAssign = meta::and_< ShouldConvert< U >, meta::not_< meta::or_< Assignable< T &, optional< U > & >, Assignable< T &, optional< U > && >, Assignable< T &, optional< U > const & >, Assignable< T &, optional< U > const && > >> >
 
using value_type = meta::_t< std::remove_cv< T > >
 

Public Member Functions

template<typename... Args, requires = (Constructible<T, Args...>())>
T & emplace (Args &&... args) noexcept(std::is_nothrow_constructible< T, Args... >::value)
 
template<typename E , typename... Args, requires = (Constructible<T, std::initializer_list<E> &, Args &&...>())>
T & emplace (std::initializer_list< E > il, Args &&... args) noexcept(std::is_nothrow_constructible< T, std::initializer_list< E > &, Args... >::value)
 
constexpr operator bool () const noexcept
 
optionaloperator= (nullopt_t) noexcept
 
optionaloperator= (optional const &)=default
 
optionaloperator= (optional &&)=default
 
template<typename U = T, requires = (meta::and_< meta::bool_<!std::is_same<optional, detail::decay_t<U>>::value && !(std::is_scalar<T>::value && std::is_same<T, detail::decay_t<U>>::value)>, Constructible<T, U>, Assignable<T &, U>>::value)>
optionaloperator= (U &&u) noexcept(std::is_nothrow_constructible< T, U >::value &&std::is_nothrow_assignable< T &, U >::value)
 
template<typename U , requires = (meta::and_< ShouldConvertAssign<U>, Constructible<T, const U &>, Assignable<T &, const U &>>::value)>
optionaloperator= (optional< U > const &that)
 
template<typename U , requires = (meta::and_< ShouldConvertAssign<U>, Constructible<T, U>, Assignable<T &, U>>::value)>
optionaloperator= (optional< U > &&that)
 
constexpr optional (nullopt_t) noexcept
 
 optional (optional const &)=default
 
 optional (optional &&)=default
 
template<typename E , typename... Args, requires = (Constructible<T, std::initializer_list<E> &, Args...>())>
constexpr optional (in_place_t, std::initializer_list< E > il, Args &&... args) noexcept(std::is_nothrow_constructible< T, std::initializer_list< E > &, Args... >::value)
 
template<typename U = T, requires = (meta::and_< meta::not_<Same<detail::decay_t<U>, in_place_t>>, meta::not_<Same<detail::decay_t<U>, optional>>, Constructible<T, U>, ConvertibleTo<U, T>>::value)>
constexpr optional (U &&v)
 
template<typename U = T, requires = (meta::and_< meta::not_<Same<detail::decay_t<U>, in_place_t>>, meta::not_<Same<detail::decay_t<U>, optional>>, Constructible<T, U>, meta::not_<ConvertibleTo<U, T>>>::value)>
constexpr optional (U &&v)
 
template<typename U , requires = (meta::and_< ShouldConvert<U>, Constructible<T, U const &>, ConvertibleTo<U const &, T>>::value)>
 optional (optional< U > const &that)
 
template<typename U , requires = (meta::and_< ShouldConvert<U>, Constructible<T, U const &>, meta::not_<ConvertibleTo<U const &, T>>>::value)>
 optional (optional< U > const &that)
 
template<typename U , requires = (meta::and_< ShouldConvert<U>, Constructible<T, U>, ConvertibleTo<U, T>>::value)>
 optional (optional< U > &&that)
 
template<typename U , requires = (meta::and_< ShouldConvert<U>, Constructible<T, U>, meta::not_<ConvertibleTo<U, T>>>::value)>
 optional (optional< U > &&that)
 
constexpr T const & value () const &
 
T & value () &
 
constexpr T const && value () const &&
 
T && value () &&
 
template<typename U , requires = (CopyConstructible<T>() && ConvertibleTo<U, T>())>
constexpr T value_or (U &&u) const &
 
template<typename U , requires = (MoveConstructible<T>() && ConvertibleTo<U, T>())>
value_or (U &&u) &&