87 template <
typename U,
typename = std::enable_if_t<std::is_constructible_v<T, U>, sfinae>>
96 return iData.has_value();
98 explicit operator bool() const noexcept final
120 return iData.value();
124 return iData.value();
128 if (iData.has_value())
129 return iData.value();
131 return aDefaultValue;
135 if (iData.has_value())
136 return iData.value();
138 return aDefaultValue;
142 if (iData.has_value())
143 return iData.value();
145 return aDefaultValue;
149 return iData.operator*();
153 return iData.operator*();
157 return iData.operator->();
161 return iData.operator->();
165 template <
typename... Args>
168 iData.emplace(std::forward<Args>(args)...);
177 iData = std::nullopt;
185 iData = std::nullopt;
191 iData = T{ rhs.value() };
193 iData = std::nullopt;
221 return std::partial_ordering::less;
223 return std::partial_ordering::greater;
225 return std::partial_ordering::equivalent;
229 std::optional<T> iData;
232 template <
typename T>
239 return lhs.
value() == rhs.value();
242 template <
typename T>
247 if (!lhs.has_value())
249 return lhs.value() == rhs.
value();
252 template <
typename T>
256 return std::partial_ordering::less;
257 else if (lhs.
has_value() > rhs.has_value())
258 return std::partial_ordering::greater;
260 return std::partial_ordering::equivalent;
261 return lhs.
value() <=> rhs.value();
264 template <
typename T>
268 return std::partial_ordering::less;
269 else if (lhs.has_value() > rhs.
has_value())
270 return std::partial_ordering::greater;
271 else if (!lhs.has_value())
272 return std::partial_ordering::equivalent;
273 return lhs.value() <=> rhs.
value();
276 template <
typename T,
typename U,
typename = std::enable_if_t<!is_optional_v<U>, sfinae>>
281 return lhs.
value() == rhs;
284 template <
typename T,
typename U,
typename = std::enable_if_t<!is_optional_v<U>, sfinae>>
289 return lhs == rhs.
value();
292 template <
typename T,
typename U,
typename = std::enable_if_t<!is_optional_v<U>, sfinae>>
296 return std::partial_ordering::less;
298 return lhs.
value() <=> rhs;
301 template <
typename T,
typename U,
typename = std::enable_if_t<!is_optional_v<U>, sfinae>>
305 return std::partial_ordering::greater;
307 return lhs <=> rhs.
value();
310 template <
typename T, std::enable_if_t<!std::is_same_v<T, abstract_t<T>>,
int> = 0>
314 return std::partial_ordering::less;
316 return lhs.
value() <=> rhs;
319 template <
typename T, std::enable_if_t<!std::is_same_v<T, abstract_t<T>>,
int> = 0>
323 return std::partial_ordering::greater;
325 return lhs <=> rhs.
value();
328 template <
typename T>
330 template <
typename T>
332 template <
typename T>
335 template <
typename T>
338 template <
typename Elem,
typename Traits,
typename T>
339 inline std::basic_ostream<Elem, Traits>& operator<<(std::basic_ostream<Elem, Traits>& aStream,
optional<T> const& aOptional)
342 aStream << aOptional.
value();
348 template <
typename Elem,
typename Traits,
typename T>
349 inline std::basic_istream<Elem, Traits>& operator>>(std::basic_istream<Elem, Traits>& aStream,
optional<T>& aOptional)
357 aStream >> aOptional.
value();
const value_type & const_reference
std::optional< T > std_type
bool has_value() const noexcept final
self_type & operator=(std::nullopt_t) noexcept final
reference & emplace(Args &&... args)
const value_type * const_pointer
bool operator==(std::nullopt_t) const
const std_type & as_std_optional() const
abstract_type::const_reference abstract_const_reference
optional(abstract_type const &other)
i_optional< abstract_t< T > > abstract_type
const_pointer operator->() const final
self_type & operator=(const abstract_type &rhs) final
bool operator!=(std::nullopt_t) const
pointer operator->() final
const_reference operator*() const final
abstract_const_reference value_or(abstract_reference aDefaultValue) const final
self_type & operator=(const abstract_t< T > &value) final
std_type & as_std_optional()
const value_type & const_reference
reference operator*() final
abstract_type::reference abstract_reference
abstract_reference value_or(abstract_reference aDefaultValue) final
bool operator==(const optional< T > &that) const
const_reference value() const final
self_type & operator=(const self_type &rhs)
std::partial_ordering operator<=>(const optional< T > &that) const
abstract_const_reference value_or(abstract_const_reference aDefaultValue) const final
optional(value_type const &other)
std_type to_std_optional() const
typename detail::abstract_type< T >::type abstract_t
typename optional_type< T >::type optional_t
std::partial_ordering operator<=>(const i_container< T, ConstIteratorType, IteratorType > &lhs, const i_container< T, ConstIteratorType, IteratorType > &rhs)
static constexpr bool value