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

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 I >
requires constructible_from<T, decltype(*std::declval<const I &>())>
T & emplace_deref (const I &it)
 
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> && assignable_from<T &, U>
constexpr optionaloperator= (optional< U > &&that)
 
template<typename U >
requires optional_should_convert_assign<U, T> && constructible_from<T, const U &> && assignable_from<T &, const U &>
constexpr optionaloperator= (optional< U > const &that)
 
template<typename U = T>
requires (!same_as<optional, detail::decay_t<U>>) && (!(satisfies<T, std::is_scalar> && same_as<T, detail::decay_t<U>>)) && constructible_from<T, U> && assignable_from<T &, U>
constexpr optionaloperator= (U &&u) noexcept(std::is_nothrow_constructible< T, U >::value &&std::is_nothrow_assignable< T &, U >::value)
 
template<typename E , typename... Args>
requires constructible_from<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)
 
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 >
requires optional_should_convert<U, T> && constructible_from<T, U const &> && convertible_to<U const &, T>
 optional (optional< U > const &that)
 
template<typename U >
requires optional_should_convert<U, T> && constructible_from<T, U const &> && (!convertible_to<U const &, T>)
 optional (optional< U > const &that)
 
template<typename U = T>
requires (!same_as<detail::decay_t<U>, in_place_t>) && (!same_as<detail::decay_t<U>, optional>) && constructible_from<T, U> && convertible_to<U, T>
constexpr optional (U &&v)
 
template<typename U = T>
requires (!same_as<detail::decay_t<U>, in_place_t>) && (!same_as<detail::decay_t<U>, optional>) && constructible_from<T, U> && (!convertible_to<U, T>)
constexpr optional (U &&v)
 
constexpr T & value () &
 
constexpr T && value () &&
 
constexpr T const & value () const &
 
constexpr T const && value () const &&
 
template<typename U >
requires move_constructible<T> && convertible_to<U, T>
constexpr T value_or (U &&u) &&
 
template<typename U >
requires copy_constructible<T> && convertible_to<U, T>
constexpr T value_or (U &&u) const &