class Optional

Declaration

template <typename T>
class Optional { /* full declaration omitted */ };

Declared at: llvm/include/llvm/ADT/Optional.h:215

Templates

T

Method Overview

  • public constexpr Optional<T>(llvm::NoneType)
  • public Optional<T>(const T & y)
  • public Optional<T>(const Optional<T> & O)
  • public Optional<T>(T && y)
  • public Optional<T>(Optional<T> && O)
  • public constexpr Optional<T>()
  • public static inline Optional<T> create(const T * y)
  • public template <typename... ArgTypes>void emplace(ArgTypes &&... Args)
  • public const T * getPointer() const
  • public T * getPointer()
  • public const T & getValue() const &
  • public T && getValue() &&
  • public T & getValue() &
  • public template <typename U>constexpr T getValueOr(U && value) const &
  • public template <typename U>T getValueOr(U && value) &&
  • public bool hasValue() const
  • public template <class Function>auto map(const Function & F) const -> Optional<decltype(F(getValue()))>
  • public template <class Function>auto map(const Function & F) && -> Optional<decltype(F(std::move(*this).getValue()))>
  • public bool operator bool() const
  • public void reset()

Methods

constexpr Optional<T>(llvm::NoneType)

Declared at: llvm/include/llvm/ADT/Optional.h:222

Parameters

llvm::NoneType

Optional<T>(const T& y)

Declared at: llvm/include/llvm/ADT/Optional.h:224

Parameters

const T& y

Optional<T>(const Optional<T>& O)

Declared at: llvm/include/llvm/ADT/Optional.h:225

Parameters

const Optional<T>& O

Optional<T>(T&& y)

Declared at: llvm/include/llvm/ADT/Optional.h:227

Parameters

T&& y

Optional<T>(Optional<T>&& O)

Declared at: llvm/include/llvm/ADT/Optional.h:228

Parameters

Optional<T>&& O

constexpr Optional<T>()

Declared at: llvm/include/llvm/ADT/Optional.h:221

static inline Optional<T> create(const T* y)

Declared at: llvm/include/llvm/ADT/Optional.h:241

Parameters

const T* y

template <typename... ArgTypes>
void emplace(ArgTypes&&... Args)

Description

Create a new object by constructing it in place with the given arguments.

Declared at: llvm/include/llvm/ADT/Optional.h:237

Templates

ArgTypes

Parameters

ArgTypes&&... Args

const T* getPointer() const

Declared at: llvm/include/llvm/ADT/Optional.h:253

T* getPointer()

Declared at: llvm/include/llvm/ADT/Optional.h:254

const T& getValue() const&

Declared at: llvm/include/llvm/ADT/Optional.h:255

T&& getValue() &&

Declared at: llvm/include/llvm/ADT/Optional.h:279

T& getValue() &

Declared at: llvm/include/llvm/ADT/Optional.h:256

template <typename U>
constexpr T getValueOr(U&& value) const&

Declared at: llvm/include/llvm/ADT/Optional.h:266

Templates

U

Parameters

U&& value

template <typename U>
T getValueOr(U&& value) &&

Declared at: llvm/include/llvm/ADT/Optional.h:283

Templates

U

Parameters

U&& value

bool hasValue() const

Declared at: llvm/include/llvm/ADT/Optional.h:259

template <class Function>
auto map(const Function& F) const
    -> Optional<decltype(F(getValue()))>

Description

Apply a function to the value if present; otherwise return None.

Declared at: llvm/include/llvm/ADT/Optional.h:272

Templates

Function

Parameters

const Function& F

template <class Function>
auto map(const Function& F) && -> Optional<
    decltype(F(std::move(*this).getValue()))>

Description

Apply a function to the value if present; otherwise return None.

Declared at: llvm/include/llvm/ADT/Optional.h:289

Templates

Function

Parameters

const Function& F

bool operator bool() const

Declared at: llvm/include/llvm/ADT/Optional.h:258

void reset()

Declared at: llvm/include/llvm/ADT/Optional.h:251