Shortcuts

Template Class optional

Inheritance Relationships

Base Type

  • private OptionalBase< T >

Class Documentation

template<class T>
class c10::optional : private OptionalBase<T>

Public Types

typedef T value_type

Public Functions

constexpr optional() noexcept
constexpr optional(nullopt_t) noexcept
optional(const optional &rhs)
optional(optional &&rhs) noexcept(value)
template<typename U = T, typename std::enable_if< std::is_constructible< T, U && >::value &&!std::is_same< typename std::decay< U >::type, in_place_t >::value &&!std::is_same< typename std::decay< U >::type, optional< T >>::value &&std::is_convertible< U &&, T >::value, bool >::type = false> constexpr optional (U &&u)
template<typename U = T, typename std::enable_if< std::is_constructible< T, U && >::value &&!std::is_same< typename std::decay< U >::type, in_place_t >::value &&!std::is_same< typename std::decay< U >::type, optional< T >>::value &&!std::is_convertible< U &&, T >::value, bool >::type = false> constexpr optional (U &&u)
template<class ...Args>
constexpr optional(in_place_t, Args&&... args)
template<class U, class... Args, typename std::enable_if< std::is_constructible< T, std::initializer_list< U >>::value, bool >::type = false> constexpr optional (in_place_t, std::initializer_list< U > il, Args &&...args)
~optional() = default
optional &operator=(nullopt_t) noexcept
optional &operator=(const optional &rhs)
optional &operator=(optional &&rhs) noexcept(value && value)
template<class U = T>
auto operator=(U &&v) -> typename std::enable_if<std::is_constructible<T, U>::value && !std::is_same<typename std::decay<U>::type, optional<T>>::value && (std::is_scalar<T>::value || std::is_same<typename std::decay<U>::type, T>::value) && std::is_assignable<T&, U>::value, optional&>::type
template<class ...Args>
void emplace(Args&&... args)
template<class U, class ...Args>
void emplace(std::initializer_list<U> il, Args&&... args)
void swap(optional<T> &rhs) noexcept(value && noexcept(swap(declval<T&>(), declval<T&>())))
constexpr operator bool() const noexcept
constexpr bool has_value() const noexcept
constexpr T const *operator->() const
constexpr T *operator->()
constexpr T const &operator*() const &
constexpr T &operator*() &
constexpr T &&operator*() &&
constexpr T const &value() const &
constexpr T &value() &
constexpr T &&value() &&
template<class V>
constexpr T value_or(V &&v) const &
template<class V>
constexpr T value_or(V &&v) &&
void reset() noexcept

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources