PyTorch
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
c10::optional< T > Class Template Reference

#include <Optional.h>

Inheritance diagram for c10::optional< T >:

Public Types

typedef T value_type
 

Public Member Functions

constexpr optional () noexcept=default
 
constexpr optional (nullopt_t) noexcept
 
 optional (const optional &rhs)=default
 
 optional (optional &&rhs)=default
 
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
 
optionaloperator= (nullopt_t) noexcept
 
optionaloperator= (const optional &rhs)=default
 
optionaloperator= (optional &&rhs)=default
 
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(std::is_nothrow_move_constructible< T >::value &&noexcept(std::swap(std::declval< T & >(), std::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
 

Member Typedef Documentation

◆ value_type

template<class T >
typedef T c10::optional< T >::value_type

Constructor & Destructor Documentation

◆ optional() [1/8]

template<class T >
constexpr c10::optional< T >::optional ( )
constexprdefaultnoexcept

◆ optional() [2/8]

template<class T >
constexpr c10::optional< T >::optional ( nullopt_t  )
inlineconstexprnoexcept

◆ optional() [3/8]

template<class T >
c10::optional< T >::optional ( const optional< T > &  rhs)
default

◆ optional() [4/8]

template<class T >
c10::optional< T >::optional ( optional< T > &&  rhs)
default

◆ optional() [5/8]

template<class T >
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 c10::optional< T >::optional ( U &&  u)
inlineconstexpr

◆ optional() [6/8]

template<class T >
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 c10::optional< T >::optional ( U &&  u)
inlineexplicitconstexpr

◆ optional() [7/8]

template<class T >
template<class... Args>
constexpr c10::optional< T >::optional ( in_place_t  ,
Args &&...  args 
)
inlineexplicitconstexpr

◆ optional() [8/8]

template<class T >
template<class U , class... Args, typename std::enable_if< std::is_constructible< T, std::initializer_list< U > > ::value, bool >::type = false>
constexpr c10::optional< T >::optional ( in_place_t  ,
std::initializer_list< U >  il,
Args &&...  args 
)
inlineexplicitconstexpr

◆ ~optional()

template<class T >
c10::optional< T >::~optional ( )
default

Member Function Documentation

◆ emplace() [1/2]

template<class T >
template<class... Args>
void c10::optional< T >::emplace ( Args &&...  args)
inline

◆ emplace() [2/2]

template<class T >
template<class U , class... Args>
void c10::optional< T >::emplace ( std::initializer_list< U >  il,
Args &&...  args 
)
inline

◆ has_value()

template<class T >
constexpr bool c10::optional< T >::has_value ( ) const
inlineconstexprnoexcept

◆ operator bool()

template<class T >
constexpr c10::optional< T >::operator bool ( ) const
inlineexplicitconstexprnoexcept

◆ operator*() [1/3]

template<class T >
constexpr T & c10::optional< T >::operator* ( ) &
inlineconstexpr

◆ operator*() [2/3]

template<class T >
constexpr T && c10::optional< T >::operator* ( ) &&
inlineconstexpr

◆ operator*() [3/3]

template<class T >
constexpr T const & c10::optional< T >::operator* ( ) const &
inlineconstexpr

◆ operator->() [1/2]

template<class T >
constexpr T * c10::optional< T >::operator-> ( )
inlineconstexpr

◆ operator->() [2/2]

template<class T >
constexpr T const * c10::optional< T >::operator-> ( ) const
inlineconstexpr

◆ operator=() [1/4]

template<class T >
optional & c10::optional< T >::operator= ( const optional< T > &  rhs)
default

◆ operator=() [2/4]

template<class T >
optional & c10::optional< T >::operator= ( nullopt_t  )
inlinenoexcept

◆ operator=() [3/4]

template<class T >
optional & c10::optional< T >::operator= ( optional< T > &&  rhs)
default

◆ operator=() [4/4]

template<class T >
template<class U = T>
auto c10::optional< T >::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
inline

◆ reset()

template<class T >
void c10::optional< T >::reset ( )
inlinenoexcept

◆ swap()

template<class T >
void c10::optional< T >::swap ( optional< T > &  rhs)
inlinenoexcept

◆ value() [1/3]

template<class T >
constexpr T & c10::optional< T >::value ( ) &
inlineconstexpr

◆ value() [2/3]

template<class T >
constexpr T && c10::optional< T >::value ( ) &&
inlineconstexpr

◆ value() [3/3]

template<class T >
constexpr T const & c10::optional< T >::value ( ) const &
inlineconstexpr

◆ value_or() [1/2]

template<class T >
template<class V >
constexpr T c10::optional< T >::value_or ( V &&  v) &&
inlineconstexpr

◆ value_or() [2/2]

template<class T >
template<class V >
constexpr T c10::optional< T >::value_or ( V &&  v) const &
inlineconstexpr

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