From a6f1807d98bec8611cd9052cf227a0c26fa580b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C5=8Dshin?= Date: Sun, 9 Jun 2024 19:59:31 -0700 Subject: [PATCH] Decouple swap from std This allows you to implement your own swap function without it having to be part of the std namespace. std::swap is still used if it's available. --- ctl/optional.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ctl/optional.h b/ctl/optional.h index 110bd5eec..26fa97bad 100644 --- a/ctl/optional.h +++ b/ctl/optional.h @@ -118,8 +118,9 @@ class optional void swap(optional& other) noexcept { + using std::swap; if (present_ && other.present_) { - std::swap(value_, other.value_); + swap(value_, other.value_); } else if (present_) { other.emplace(std::move(value_)); reset();