@@ -33,6 +33,40 @@ struct Error {
3333 * @endcode
3434 */
3535 friend std::ostream& operator <<(std::ostream& os, const error::Error& err);
36+
37+ /* *
38+ * @brief Checks if two error objects are equal.
39+ * @param lhs The left-hand side error object.
40+ * @param rhs The right-hand side error object.
41+ * @return True if equal, false otherwise.
42+ *
43+ * This operator allows the comparison of two error objects using the == operator.
44+ *
45+ * @code{.cpp}
46+ * const auto err = error::make("unknown error");
47+ * const auto other_err = err;
48+ *
49+ * assert(err == other_err);
50+ * @endcode
51+ */
52+ friend bool operator ==(const Error& lhs, const Error& rhs);
53+
54+ /* *
55+ * @brief Checks if two error objects are not equal.
56+ * @param lhs The left-hand side error object.
57+ * @param rhs The right-hand side error object.
58+ * @return True if not equal, false otherwise.
59+ *
60+ * This operator allows the comparison of two error objects using the != operator.
61+ *
62+ * @code{.cpp}
63+ * const auto err = error::make("unknown error");
64+ * const auto other_err = error::make("other error");
65+ *
66+ * assert(err != other_err);
67+ * @endcode
68+ */
69+ friend bool operator !=(const Error& lhs, const Error& rhs);
3670};
3771
3872/* *
@@ -54,22 +88,6 @@ Error format(fmt::format_string<T...> fmt, T&&... args) {
5488 return error::make (fmt::format (fmt, std::forward<T>(args)...));
5589}
5690
57- /* *
58- * @brief Checks if two error objects are equal.
59- * @param lhs The left-hand side error object.
60- * @param rhs The right-hand side error object.
61- * @return True if equal, false otherwise.
62- */
63- bool operator ==(const Error& lhs, const Error& rhs);
64-
65- /* *
66- * @brief Checks if two error objects are not equal.
67- * @param lhs The left-hand side error object.
68- * @param rhs The right-hand side error object.
69- * @return True if not equal, false otherwise.
70- */
71- bool operator !=(const Error& lhs, const Error& rhs);
72-
7391} // namespace error
7492
7593template <>
0 commit comments