5#ifndef INCLUDE_V8_MAYBE_H_
6#define INCLUDE_V8_MAYBE_H_
16namespace api_internal {
74 return std::move(value_);
82 return has_value_ ? value_ : default_value;
95 Maybe() : has_value_(false) {}
96 explicit Maybe(
const T& t) : has_value_(true), value_(t) {}
97 explicit Maybe(T&& t) : has_value_(
true), value_(std::move(t)) {}
106 template <
class U, std::enable_if_t<!std::is_lvalue_reference_v<U>>*>
123template <
class T, std::enable_if_t<!std::is_lvalue_reference_v<T>>* =
nullptr>
146 Maybe() : is_valid_(false) {}
147 explicit Maybe(JustTag) : is_valid_(
true) {}
V8_INLINE bool IsNothing() const
V8_INLINE bool operator!=(const Maybe &other) const
V8_INLINE bool operator==(const Maybe &other) const
V8_INLINE bool IsJust() const
friend Maybe< U > Nothing()
V8_INLINE bool IsNothing() const
friend Maybe< U > Just(U &&u)
V8_INLINE bool operator!=(const Maybe &other) const
V8_INLINE T FromJust() &&
V8_WARN_UNUSED_RESULT V8_INLINE bool To(T *out) const
V8_INLINE void Check() const
friend Maybe< U > Just(const U &u)
V8_INLINE T FromJust() const &
V8_INLINE bool operator==(const Maybe &other) const
V8_INLINE bool IsJust() const
V8_INLINE T ToChecked() const
V8_INLINE T FromMaybe(const T &default_value) const
V8_EXPORT void FromJustIsNothing()
Maybe< T > Just(const T &t)
#define V8_LIKELY(condition)
#define V8_WARN_UNUSED_RESULT
#define V8_UNLIKELY(condition)