PyTorch
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Typedefs | Functions | Variables
Optional.h File Reference
#include <c10/macros/Macros.h>
#include <c10/util/ArrayRef.h>
#include <c10/util/in_place.h>
#include <cassert>
#include <functional>
#include <initializer_list>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>
#include <c10/util/C++17.h>
#include <c10/util/Metaprogramming.h>

Go to the source code of this file.

Classes

struct  c10::trivial_init_t
 
struct  c10::nullopt_t
 
class  c10::bad_optional_access
 
union  c10::storage_t< T >
 
union  c10::constexpr_storage_t< T >
 
struct  c10::optional_base< T >
 
struct  c10::constexpr_optional_base< T >
 
struct  c10::trivially_copyable_optimization_optional_base< T >
 
class  c10::arrayref_optional_base< ArrayRefT >
 
union  c10::arrayref_optional_base< ArrayRefT >::storage
 
struct  c10::arrayref_optional_base< ArrayRefT >::storage::raw
 
struct  c10::detail_::is_arrayref< T >
 
struct  c10::detail_::is_arrayref< c10::ArrayRef< T > >
 
class  c10::optional< T >
 
class  c10::optional< T & >
 
class  c10::optional< T && >
 

Namespaces

namespace  c10
 
namespace  c10::detail_
 
namespace  std
 

Macros

#define TR2_OPTIONAL_REQUIRES(...)    typename std::enable_if<__VA_ARGS__::value, bool>::type = false
 
#define TR2_OPTIONAL_ASSERTED_EXPRESSION(CHECK, EXPR)    ((CHECK) ? (EXPR) : ([] { assert(!#CHECK); }(), (EXPR)))
 
#define TR2_OPTIONAL_HOST_CONSTEXPR   constexpr
 

Typedefs

template<class T >
using c10::OptionalBase = std::conditional_t< detail_::is_arrayref< T >::value, arrayref_optional_base< T >, std::conditional_t< std::is_trivially_destructible< T >::value &&std::is_trivially_copyable< T >::value &&std::is_copy_constructible< trivially_copyable_optimization_optional_base< T > >::value &&std::is_copy_assignable< trivially_copyable_optimization_optional_base< T > >::value, trivially_copyable_optimization_optional_base< T >, std::conditional_t< std::is_trivially_destructible< T >::value, constexpr_optional_base< std::remove_const_t< T > >, optional_base< std::remove_const_t< T > > > > >
 

Functions

template<class T >
constexpr T && c10::constexpr_forward (typename std::remove_reference< T >::type &t) noexcept
 
template<class T >
constexpr T && c10::constexpr_forward (typename std::remove_reference< T >::type &&t) noexcept
 
template<class T >
constexpr std::remove_reference< T >::type && c10::constexpr_move (T &&t) noexcept
 
template<class T , class F >
constexpr T c10::value_or_else (const optional< T > &v, F &&func)
 
template<class T , class F >
constexpr T c10::value_or_else (optional< T > &&v, F &&func)
 
template<class T >
constexpr bool c10::operator== (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool c10::operator!= (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool c10::operator< (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool c10::operator> (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool c10::operator<= (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool c10::operator>= (const optional< T > &x, const optional< T > &y)
 
template<class T >
constexpr bool c10::operator== (const optional< T > &x, nullopt_t) noexcept
 
template<class T >
constexpr bool c10::operator== (nullopt_t, const optional< T > &x) noexcept
 
template<class T >
constexpr bool c10::operator!= (const optional< T > &x, nullopt_t) noexcept
 
template<class T >
constexpr bool c10::operator!= (nullopt_t, const optional< T > &x) noexcept
 
template<class T >
constexpr bool c10::operator< (const optional< T > &, nullopt_t) noexcept
 
template<class T >
constexpr bool c10::operator< (nullopt_t, const optional< T > &x) noexcept
 
template<class T >
constexpr bool c10::operator<= (const optional< T > &x, nullopt_t) noexcept
 
template<class T >
constexpr bool c10::operator<= (nullopt_t, const optional< T > &) noexcept
 
template<class T >
constexpr bool c10::operator> (const optional< T > &x, nullopt_t) noexcept
 
template<class T >
constexpr bool c10::operator> (nullopt_t, const optional< T > &) noexcept
 
template<class T >
constexpr bool c10::operator>= (const optional< T > &, nullopt_t) noexcept
 
template<class T >
constexpr bool c10::operator>= (nullopt_t, const optional< T > &x) noexcept
 
template<class T , class U >
constexpr bool c10::operator== (const optional< T > &x, const U &v)
 
template<class T , class U >
constexpr bool c10::operator== (const U &v, const optional< T > &x)
 
template<class T , class U >
constexpr bool c10::operator!= (const optional< T > &x, const U &v)
 
template<class T , class U >
constexpr bool c10::operator!= (const U &v, const optional< T > &x)
 
template<class T , class U >
constexpr bool c10::operator< (const optional< T > &x, const U &v)
 
template<class T , class U >
constexpr bool c10::operator> (const U &v, const optional< T > &x)
 
template<class T , class U >
constexpr bool c10::operator> (const optional< T > &x, const U &v)
 
template<class T , class U >
constexpr bool c10::operator< (const U &v, const optional< T > &x)
 
template<class T , class U >
constexpr bool c10::operator>= (const optional< T > &x, const U &v)
 
template<class T , class U >
constexpr bool c10::operator<= (const U &v, const optional< T > &x)
 
template<class T , class U >
constexpr bool c10::operator<= (const optional< T > &x, const U &v)
 
template<class T , class U >
constexpr bool c10::operator>= (const U &v, const optional< T > &x)
 
template<class T >
constexpr bool c10::operator== (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator== (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool c10::operator!= (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator!= (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool c10::operator< (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator> (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool c10::operator> (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator< (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool c10::operator>= (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator<= (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool c10::operator<= (const optional< T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator>= (const T &v, const optional< T & > &x)
 
template<class T >
constexpr bool c10::operator== (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator== (const T &v, const optional< const T & > &x)
 
template<class T >
constexpr bool c10::operator!= (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator!= (const T &v, const optional< const T & > &x)
 
template<class T >
constexpr bool c10::operator< (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator> (const T &v, const optional< const T & > &x)
 
template<class T >
constexpr bool c10::operator> (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator< (const T &v, const optional< const T & > &x)
 
template<class T >
constexpr bool c10::operator>= (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator<= (const T &v, const optional< const T & > &x)
 
template<class T >
constexpr bool c10::operator<= (const optional< const T & > &x, const T &v)
 
template<class T >
constexpr bool c10::operator>= (const T &v, const optional< const T & > &x)
 
template<class T >
void c10::swap (optional< T > &x, optional< T > &y) noexcept(noexcept(x.swap(y)))
 
template<class T >
constexpr optional< typename std::decay< T >::type > c10::make_optional (T &&v)
 
template<class X >
constexpr optional< X & > c10::make_optional (std::reference_wrapper< X > v)
 

Variables

constexpr struct c10::trivial_init_t c10::trivial_init
 
constexpr nullopt_t c10::nullopt {0}
 

Macro Definition Documentation

◆ TR2_OPTIONAL_ASSERTED_EXPRESSION

#define TR2_OPTIONAL_ASSERTED_EXPRESSION (   CHECK,
  EXPR 
)     ((CHECK) ? (EXPR) : ([] { assert(!#CHECK); }(), (EXPR)))

◆ TR2_OPTIONAL_HOST_CONSTEXPR

#define TR2_OPTIONAL_HOST_CONSTEXPR   constexpr

◆ TR2_OPTIONAL_REQUIRES

#define TR2_OPTIONAL_REQUIRES (   ...)     typename std::enable_if<__VA_ARGS__::value, bool>::type = false