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

Public Types

using value_type = meta::_t< std::remove_cv< T > >
 

Public Member Functions

template<typename... Args>
requires constructible_from< T, Args... > T & emplace (Args &&... args) noexcept(std::is_nothrow_constructible< T, Args... >::value)
 
template<typename E , typename... Args>
requires constructible_from< 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)
 
template<typename U >
requires optional_should_convert< U, T > &&constructible_from< T, U const & > explicit (!convertible_to< U const &, T >) optional(optional< U > const &that)
 
constexpr operator bool () const noexcept
 
constexpr optionaloperator= (nullopt_t) noexcept
 
optionaloperator= (optional &&)=default
 
optionaloperator= (optional const &)=default
 
template<typename U >
requires optional_should_convert_assign< U, T > &&constructible_from< T, U > &&constexpr assignable_from< T &, U > optionaloperator= (optional< U > &&that)
 
template<typename U >
requires optional_should_convert_assign< U, T > &&constructible_from< T, const U & > &&constexpr assignable_from< T &, const U & > optionaloperator= (optional< U > const &that)
 
std::is_scalar &&same_as< T, detail::decay_t< U > > &&constructible_from< T, U > &&constexpr assignable_from< T &, U > optionaloperator= (U &&u) noexcept(std::is_nothrow_constructible< T, U >::value &&std::is_nothrow_assignable< T &, U >::value)
 
template<typename E , typename... Args>
requires constexpr constructible_from< T, std::initializer_list< E > &, Args... > optional (in_place_t, std::initializer_list< E > il, Args &&... args) noexcept(std::is_nothrow_constructible< T, std::initializer_list< E > &, Args... >::value)
 
constexpr optional (nullopt_t) noexcept
 
 optional (optional &&)=default
 
 optional (optional const &)=default
 
template<typename U >
requires optional_should_convert< U, T > &&constructible_from< T, U > &&convertible_to< U, T > optional (optional< U > &&that)
 
template<typename U >
requires optional_should_convert< U, T > &&constructible_from< T, U > &&!convertible_to< U, T > optional (optional< U > &&that)
 
template<typename U = T>
 requires (!same_as< detail::decay_t< U >, in_place_t >) &&(!same_as< detail
 
template<typename U = T>
 requires (!same_as< optional, detail::decay_t< U >>) &&(!(satisfies< T
 
constexpr T & value () &
 
constexpr T && value () &&
 
constexpr T const & value () const &
 
constexpr T const && value () const &&
 
template<typename U >
requires move_constructible< T > &&constexpr convertible_to< U, T > T value_or (U &&u) &&
 
template<typename U >
requires copy_constructible< T > &&constexpr convertible_to< U, T > T value_or (U &&u) const &