9#ifndef CLANG_BASIC_CUSTOMIZABLEOPTIONAL_H
10#define CLANG_BASIC_CUSTOMIZABLEOPTIONAL_H
12#include "llvm/ADT/Hashing.h"
13#include "llvm/Support/Compiler.h"
14#include "llvm/Support/type_traits.h"
22namespace optional_detail {
41 : Storage(
std::in_place,
std::move(y)) {}
44 template <
typename... ArgTypes>
55 Storage = std::move(y);
61 template <
typename... ArgTypes>
void emplace(ArgTypes &&...Args) {
62 Storage.emplace(std::forward<ArgTypes>(Args)...);
71 void reset() { Storage.reset(); }
73 LLVM_DEPRECATED(
"Use &*X instead.",
"&*X")
74 constexpr const
T *
getPointer()
const {
return &Storage.value(); }
75 LLVM_DEPRECATED(
"Use &*X instead.",
"&*X")
77 LLVM_DEPRECATED(
"std::optional::value is throwing. Use *X instead",
"*X")
78 constexpr const
T &
value() const & {
return Storage.value(); }
79 LLVM_DEPRECATED(
"std::optional::value is throwing. Use *X instead",
"*X")
80 T &
value() & {
return Storage.value(); }
83 constexpr bool has_value()
const {
return Storage.has_value(); }
84 constexpr const T *
operator->()
const {
return &Storage.value(); }
86 constexpr const T &
operator*() const & {
return Storage.value(); }
89 template <
typename U>
constexpr T value_or(
U &&alt)
const & {
93 LLVM_DEPRECATED(
"std::optional::value is throwing. Use *X instead",
"*X")
94 T &&
value() && {
return std::move(Storage.value()); }
95 T &&
operator*() && {
return std::move(Storage.value()); }