From f5ee4f14517fe9330166f75ec82d89f9f68ff814 Mon Sep 17 00:00:00 2001 From: Joris Putcuyps Date: Sat, 25 Apr 2026 20:19:58 +0200 Subject: [PATCH] Swap can be part of the etl namespace and let ADL do its thing --- 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 2bb2ca9a..5221bef1 100644 --- a/include/etl/expected.h +++ b/include/etl/expected.h @@ -1381,24 +1381,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