From eb285643ed5dab8125e9c6bc94abd7ef562096a5 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Thu, 27 Feb 2025 23:58:57 +0100 Subject: Finish work on deducing this, for now --- asl/types/option.hpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'asl/types/option.hpp') diff --git a/asl/types/option.hpp b/asl/types/option.hpp index b32483b..8b5f313 100644 --- a/asl/types/option.hpp +++ b/asl/types/option.hpp @@ -365,8 +365,7 @@ public: } } - template - constexpr auto&& value(this Self&& self) + constexpr auto&& value(this auto&& self) { ASL_ASSERT_RELEASE(self.has_value()); return ASL_FWD(self).m_payload.as_init_unsafe(); @@ -386,19 +385,18 @@ public: return has_value() ? ASL_MOVE(value()) : static_cast(ASL_FWD(other_value)); } - template - constexpr T& emplace(Args&&... args) & - requires constructible_from + constexpr T& emplace(auto&&... args) & + requires constructible_from { if (has_value()) { reset(); } construct(ASL_FWD(args)...); return value(); } - template - constexpr auto and_then(this Self&& self, F&& f) + template + constexpr auto and_then(this auto&& self, F&& f) { - using Result = invoke_result_t>; + using Result = invoke_result_t>; static_assert(is_option); if (self.has_value()) @@ -408,10 +406,10 @@ public: return Result{ asl::nullopt }; } - template - constexpr auto transform(this Self&& self, F&& f) + template + constexpr auto transform(this auto&& self, F&& f) { - using Result = invoke_result_t>; + using Result = invoke_result_t>; if (self.has_value()) { return option>{ -- cgit