[#beman-optional-operator_eq-04] = xref:beman.adoc[beman]::xref:beman/optional.adoc[optional]::operator== :relfileprefix: ../../ :mrdocs: Equality operators == Synopses Declared in `<beman/optional/optional.hpp>` Compares two `nullopt_t` objects for equality. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- constexpr bool xref:beman/optional/operator_eq-03.adoc[operator==]( xref:beman/optional/nullopt_t.adoc[nullopt_t] lhs, xref:beman/optional/nullopt_t.adoc[nullopt_t] rhs) noexcept; ---- [.small]#xref:beman/optional/operator_eq-03.adoc[_» more..._]# Compares two optionals for equality. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool xref:beman/optional/operator_eq-08.adoc[operator==]( xref:beman/optional/optional-03.adoc[optional<T>] const& lhs, xref:beman/optional/optional-03.adoc[optional<U>] const& rhs) requires detail::optional_eq_rel<T, U>; ---- [.small]#xref:beman/optional/operator_eq-08.adoc[_» more..._]# Compares an optional against `nullopt`. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<class T> constexpr bool xref:beman/optional/operator_eq-00.adoc[operator==]( xref:beman/optional/optional-03.adoc[optional<T>] const& lhs, xref:beman/optional/nullopt_t.adoc[nullopt_t] rhs) noexcept; ---- [.small]#xref:beman/optional/operator_eq-00.adoc[_» more..._]# Compares an engaged optional's value against a value for equality. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool xref:beman/optional/operator_eq-09.adoc[operator==]( xref:beman/optional/optional-03.adoc[optional<T>] const& lhs, U const& rhs) requires (!detail::is_optional<U>) && detail::optional_eq_rel<T, U>; ---- [.small]#xref:beman/optional/operator_eq-09.adoc[_» more..._]# Compares a value against an engaged optional's value for equality. [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< typename T, typename U> constexpr bool xref:beman/optional/operator_eq-0b.adoc[operator==]( T const& lhs, xref:beman/optional/optional-03.adoc[optional<U>] const& rhs) requires (!detail::is_optional<T>) && detail::optional_eq_rel<T, U>; ---- [.small]#xref:beman/optional/operator_eq-0b.adoc[_» more..._]# == Return Value * Always `true`, since all `nullopt_t` objects compare equal. * `true` if both are disengaged, or both are engaged and their contained values are equal. * `true` if `lhs` is disengaged. * `true` if `lhs` is engaged and its contained value equals `rhs.` * `true` if `rhs` is engaged and `lhs` equals its contained value. == Parameters [cols="1,4"] |=== | Name| Description | *lhs* | The left‐hand `nullopt_t` object. | *rhs* | The right‐hand `nullopt_t` object. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#