From 6726a96f0cf3c230e9caa2abd40fcfbf03fe73a4 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Sun, 3 Nov 2024 19:08:01 +0100 Subject: A bunch of cleanup --- asl/option.hpp | 70 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'asl/option.hpp') diff --git a/asl/option.hpp b/asl/option.hpp index 0c816f4..5f53ad8 100644 --- a/asl/option.hpp +++ b/asl/option.hpp @@ -23,24 +23,24 @@ namespace option_internal template concept convertible_from_option = - convertible&, T> && - convertible&, T> && - convertible&&, T> && - convertible&&, T>; + convertible_from&> && + convertible_from&> && + convertible_from&&> && + convertible_from&&>; template concept constructible_from_option = - constructible&> && - constructible&> && - constructible&&> && - constructible&&>; + constructible_from&> && + constructible_from&> && + constructible_from&&> && + constructible_from&&>; template concept assignable_from_option = - assignable&> && - assignable&> && - assignable&&> && - assignable&&>; + assignable_from&> && + assignable_from&> && + assignable_from&&> && + assignable_from&&>; template concept convertible_constructible_from_option = @@ -57,7 +57,7 @@ template concept is_option = requires { typename T::type; - requires is_same, option>; + requires same_as, option>; }; template @@ -112,11 +112,11 @@ public: constexpr option(nullopt_t) {} // NOLINT(*-explicit-conversions) template - constexpr explicit (!convertible) + constexpr explicit (!convertible_from) option(U&& value) requires ( - constructible && - !is_same, option> + constructible_from && + !same_as, option> ) { construct(ASL_FWD(value)); @@ -150,10 +150,10 @@ public: } template - constexpr explicit (!convertible) + constexpr explicit (!convertible_from) option(const option& other) requires ( - constructible && + constructible_from && !option_internal::convertible_constructible_from_option ) { @@ -164,10 +164,10 @@ public: } template - constexpr explicit (!convertible) + constexpr explicit (!convertible_from) option(option&& other) requires ( - constructible && + constructible_from && !option_internal::convertible_constructible_from_option ) { @@ -186,9 +186,9 @@ public: template constexpr option& operator=(U&& value) & requires ( - assignable && - constructible && - !is_same, option> + assignable_from && + constructible_from && + !same_as, option> ) { if (m_has_value) @@ -263,8 +263,8 @@ public: template constexpr option& operator=(const option& other) & requires ( - constructible && - assignable && + constructible_from && + assignable_from && !option_internal::convertible_constructible_assignable_from_option ) { @@ -290,8 +290,8 @@ public: template constexpr option& operator=(option&& other) & requires ( - constructible && - assignable && + constructible_from && + assignable_from && !option_internal::convertible_constructible_assignable_from_option ) { @@ -337,7 +337,7 @@ public: constexpr T&& value() && { - ASL_ASSERT(m_has_value); // @Todo Release assert + ASL_ASSERT_RELEASE(m_has_value); if constexpr (kIsTrivial) { return ASL_MOVE(m_payload); @@ -350,7 +350,7 @@ public: constexpr T& value() & { - ASL_ASSERT(m_has_value); // @Todo Release assert + ASL_ASSERT_RELEASE(m_has_value); if constexpr (kIsTrivial) { return m_payload; @@ -363,7 +363,7 @@ public: constexpr const T& value() const& { - ASL_ASSERT(m_has_value); // @Todo Release assert + ASL_ASSERT_RELEASE(m_has_value); if constexpr (kIsTrivial) { return m_payload; @@ -376,21 +376,21 @@ public: template constexpr T value_or(U&& other_value) const& - requires copy_constructible && convertible + requires copy_constructible && convertible_from { return has_value() ? value() : static_cast(ASL_FWD(other_value)); } template constexpr T value_or(U&& other_value) && - requires move_constructible && convertible + requires move_constructible && convertible_from { return has_value() ? ASL_MOVE(value()) : static_cast(ASL_FWD(other_value)); } template constexpr T& emplace(Args&&... args) & - requires constructible + requires constructible_from { if (m_has_value) { reset(); } construct(ASL_FWD(args)...); @@ -465,14 +465,14 @@ public: template constexpr option or_else(F&& f) const& - requires is_same>, option> + requires same_as>, option> { return has_value() ? *this : invoke(ASL_FWD(f)); } template constexpr option or_else(F&& f) && - requires is_same>, option> + requires same_as>, option> { return has_value() ? ASL_MOVE(*this) : invoke(ASL_FWD(f)); } -- cgit