Move comparison operators of etl::expected to namespace etl (#1287)

* Remove AppVeyor build status badge

Removed AppVeyor build status badge from README.

* Update README.md

* Update CONTRIBUTING.md

Updated the instructions for contributing.

* Fix for issue 1276 "Data corruption in the etl::bip_buffer_spsc_atomic" (#1277)

* Reproduce data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Fix data corruption bug in the `etl::bip_buffer_spsc_atomic`.

* Move comparison operators of etl::expected to namespace etl

---------

Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
Co-authored-by: Sergei <sergej.shirokov@gmail.com>
This commit is contained in:
Roland Reichwein 2026-02-02 11:46:00 +01:00 committed by John Wellbelove
parent d8d4187176
commit 353c36c393

View File

@ -1296,132 +1296,132 @@ namespace etl
}
#endif
};
}
//*******************************************
/// Equivalence operators.
//*******************************************
template <typename TValue, typename TError, typename TValue2, typename TError2>
ETL_CONSTEXPR14
bool operator ==(const etl::expected<TValue, TError>& lhs, const etl::expected<TValue2, TError2>& rhs)
{
if (lhs.has_value() != rhs.has_value())
//*******************************************
/// Equivalence operators.
//*******************************************
template <typename TValue, typename TError, typename TValue2, typename TError2>
ETL_CONSTEXPR14
bool operator ==(const etl::expected<TValue, TError>& lhs, const etl::expected<TValue2, TError2>& rhs)
{
return false;
if (lhs.has_value() != rhs.has_value())
{
return false;
}
if (lhs.has_value())
{
return lhs.value() == rhs.value();
}
return lhs.error() == rhs.error();
}
if (lhs.has_value())
//*******************************************
template <typename TValue, typename TError, typename TValue2>
ETL_CONSTEXPR14
bool operator ==(const etl::expected<TValue, TError>& lhs, const TValue2& rhs)
{
return lhs.value() == rhs.value();
if (!lhs.has_value())
{
return false;
}
return lhs.value() == rhs;
}
return lhs.error() == rhs.error();
}
//*******************************************
template <typename TValue, typename TError, typename TValue2>
ETL_CONSTEXPR14
bool operator ==(const etl::expected<TValue, TError>& lhs, const TValue2& rhs)
{
if (!lhs.has_value())
//*******************************************
template <typename TValue, typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator ==(const etl::expected<TValue, TError>& lhs, const etl::unexpected<TError2>& rhs)
{
return false;
if (lhs.has_value())
{
return false;
}
return lhs.error() == rhs.error();
}
return lhs.value() == rhs;
}
//*******************************************
template <typename TValue, typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator ==(const etl::expected<TValue, TError>& lhs, const etl::unexpected<TError2>& rhs)
{
if (lhs.has_value())
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator ==(const etl::expected<void, TError>& lhs, const etl::expected<void, TError2>& rhs)
{
return false;
if (lhs.has_value() != rhs.has_value())
{
return false;
}
if (lhs.has_value())
{
return true;
}
return lhs.error() == rhs.error();
}
return lhs.error() == rhs.error();
}
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator ==(const etl::expected<void, TError>& lhs, const etl::expected<void, TError2>& rhs)
{
if (lhs.has_value() != rhs.has_value())
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator ==(const etl::expected<void, TError>& lhs, const etl::unexpected<TError2>& rhs)
{
return false;
if (lhs.has_value())
{
return false;
}
return lhs.error() == rhs.error();
}
if (lhs.has_value())
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator ==(const etl::unexpected<TError>& lhs, const etl::unexpected<TError2>& rhs)
{
return true;
return lhs.error() == rhs.error();
}
return lhs.error() == rhs.error();
}
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator ==(const etl::expected<void, TError>& lhs, const etl::unexpected<TError2>& rhs)
{
if (lhs.has_value())
//*******************************************
template <typename TValue, typename TError, typename TValue2, typename TError2>
ETL_CONSTEXPR14
bool operator !=(const etl::expected<TValue, TError>& lhs, const etl::expected<TValue2, TError2>& rhs)
{
return false;
return !(lhs == rhs);
}
return lhs.error() == rhs.error();
}
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator ==(const etl::unexpected<TError>& lhs, const etl::unexpected<TError2>& rhs)
{
return lhs.error() == rhs.error();
}
//*******************************************
template <typename TValue, typename TError, typename TValue2>
ETL_CONSTEXPR14
bool operator !=(const etl::expected<TValue, TError>& lhs, const TValue2& rhs)
{
return !(lhs == rhs);
}
//*******************************************
template <typename TValue, typename TError, typename TValue2, typename TError2>
ETL_CONSTEXPR14
bool operator !=(const etl::expected<TValue, TError>& lhs, const etl::expected<TValue2, TError2>& rhs)
{
return !(lhs == rhs);
}
//*******************************************
template <typename TValue, typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator !=(const etl::expected<TValue, TError>& lhs, const etl::unexpected<TError2>& rhs)
{
return !(lhs == rhs);
}
//*******************************************
template <typename TValue, typename TError, typename TValue2>
ETL_CONSTEXPR14
bool operator !=(const etl::expected<TValue, TError>& lhs, const TValue2& rhs)
{
return !(lhs == rhs);
}
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator !=(const etl::expected<void, TError>& lhs, const etl::expected<void, TError2>& rhs)
{
return !(lhs == rhs);
}
//*******************************************
template <typename TValue, typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator !=(const etl::expected<TValue, TError>& lhs, const etl::unexpected<TError2>& rhs)
{
return !(lhs == rhs);
}
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator !=(const etl::expected<void, TError>& lhs, const etl::unexpected<TError2>& rhs)
{
return !(lhs == rhs);
}
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator !=(const etl::expected<void, TError>& lhs, const etl::expected<void, TError2>& rhs)
{
return !(lhs == rhs);
}
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator !=(const etl::expected<void, TError>& lhs, const etl::unexpected<TError2>& rhs)
{
return !(lhs == rhs);
}
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator !=(const etl::unexpected<TError>& lhs, const etl::unexpected<TError2>& rhs)
{
return !(lhs == rhs);
//*******************************************
template <typename TError, typename TError2>
ETL_CONSTEXPR14
bool operator !=(const etl::unexpected<TError>& lhs, const etl::unexpected<TError2>& rhs)
{
return !(lhs == rhs);
}
}
//*******************************************