From 5ccbc6fbff06f523c44fbc563681a0a9fe28a93f Mon Sep 17 00:00:00 2001 From: Joris Putcuyps Date: Tue, 28 Apr 2026 10:23:52 +0200 Subject: [PATCH] Swap can be part of the etl namespace and let ADL do its thing (#1414) * Print test names at test time (#1343) * Fix operator| conflict with std::ranges (#1395) * Swap can be part of the etl namespace and let ADL do its thing --------- Co-authored-by: Roland Reichwein Co-authored-by: John Wellbelove Co-authored-by: John Wellbelove --- include/etl/expected.h | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/include/etl/expected.h b/include/etl/expected.h index 503b08ba..a8335247 100644 --- a/include/etl/expected.h +++ b/include/etl/expected.h @@ -1380,24 +1380,25 @@ namespace etl { return !(lhs == rhs); } + + //******************************************* + /// Swap etl::expected. + //******************************************* + template + ETL_CONSTEXPR14 void swap(etl::expected& lhs, etl::expected& rhs) + { + lhs.swap(rhs); + } + + //******************************************* + /// Swap etl::unexpected. + //******************************************* + template + ETL_CONSTEXPR14 void swap(etl::unexpected& lhs, etl::unexpected& rhs) + { + lhs.swap(rhs); + } + } // namespace etl -//******************************************* -/// Swap etl::expected. -//******************************************* -template -ETL_CONSTEXPR14 void swap(etl::expected& lhs, etl::expected& rhs) -{ - lhs.swap(rhs); -} - -//******************************************* -/// Swap etl::unexpected. -//******************************************* -template -ETL_CONSTEXPR14 void swap(etl::unexpected& lhs, etl::unexpected& rhs) -{ - lhs.swap(rhs); -} - #endif