From a808626873cde6665fbcb27de4f1a8e16518b2da Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Tue, 25 Feb 2025 00:08:02 +0100 Subject: Start using deducing this, needs more utilities work --- asl/types/option.hpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'asl/types/option.hpp') diff --git a/asl/types/option.hpp b/asl/types/option.hpp index 86cfca3..5cbb759 100644 --- a/asl/types/option.hpp +++ b/asl/types/option.hpp @@ -365,23 +365,11 @@ public: } } - // @Todo(C++23) Deducing this - constexpr T&& value() && + template + constexpr auto&& value(this Self&& self) { - ASL_ASSERT_RELEASE(has_value()); - return ASL_MOVE(m_payload).as_init_unsafe(); - } - - constexpr T& value() & - { - ASL_ASSERT_RELEASE(has_value()); - return m_payload.as_init_unsafe(); - } - - constexpr const T& value() const& - { - ASL_ASSERT_RELEASE(has_value()); - return m_payload.as_init_unsafe(); + ASL_ASSERT_RELEASE(self.has_value()); + return ASL_FWD(self).m_payload.as_init_unsafe(); } template -- cgit