71 Optional (Head&& head, Tail&&... tail)
75 template <
typename Other>
80 template <
typename Other>
83 : opt (std::move (other.opt)) {}
85 template <
typename Other, std::enable_if_t<! IsOptional<std::decay_t<Other>>::value,
int> = 0>
93 template <
typename Other>
101 template <
typename Other>
105 opt = std::move (other.opt);
109 template <
typename... Other>
110 auto& emplace (Other&&... other)
115 void reset()
noexcept
123 opt.swap (other.opt);
126 decltype (
auto) operator->() {
return opt.operator->(); }
127 decltype (
auto) operator->()
const {
return opt.operator->(); }
128 decltype (
auto)
operator* () {
return opt.operator* (); }
129 decltype (
auto)
operator* ()
const {
return opt.operator* (); }
131 explicit operator bool()
const noexcept {
return opt.has_value(); }
132 bool hasValue()
const noexcept {
return opt.has_value(); }
134 template <
typename U>
135 decltype (
auto) orFallback (U&& fallback)
const& {
return opt.value_or (
std::forward<U> (fallback)); }
137 template <
typename U>
138 decltype (
auto) orFallback (U&& fallback) & {
return opt.value_or (
std::forward<U> (fallback)); }
141 template <typename T, typename U> friend bool operator op (const Optional<T>&, const Optional<U>&); \
142 template <typename T> friend bool operator op (const Optional<T>&, Nullopt); \
143 template <typename T> friend bool operator op (Nullopt, const Optional<T>&); \
144 template <typename T, typename U> friend bool operator op (const Optional<T>&, const U&); \
145 template <typename T, typename U> friend bool operator op (const T&, const Optional<U>&);
147 JUCE_OPTIONAL_OPERATORS
152 template <
typename Other>