diff options
Diffstat (limited to 'third_party/fuchsia/repo/sdk/lib/fit/include/lib/fit/nullable.h')
-rw-r--r-- | third_party/fuchsia/repo/sdk/lib/fit/include/lib/fit/nullable.h | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/third_party/fuchsia/repo/sdk/lib/fit/include/lib/fit/nullable.h b/third_party/fuchsia/repo/sdk/lib/fit/include/lib/fit/nullable.h index d6ba9b7ff..56892693b 100644 --- a/third_party/fuchsia/repo/sdk/lib/fit/include/lib/fit/nullable.h +++ b/third_party/fuchsia/repo/sdk/lib/fit/include/lib/fit/nullable.h @@ -41,8 +41,8 @@ constexpr inline bool is_null(T&&) { // with nullptr. template <typename T> struct is_nullable - : public std::integral_constant<bool, std::is_constructible<T, decltype(nullptr)>::value && - std::is_assignable<T&, decltype(nullptr)>::value && + : public std::integral_constant<bool, std::is_constructible_v<T, decltype(nullptr)> && + std::is_assignable_v<T&, decltype(nullptr)> && is_comparable_with_null<T>::value> {}; template <> struct is_nullable<void> : public std::false_type {}; @@ -62,8 +62,8 @@ struct is_nullable<void> : public std::false_type {}; // TODO(fxbug.dev/4681): fit::nullable does not precisely mirror // cpp17::optional. This should be corrected to avoid surprises when switching // between the types. -template <typename T, bool = (is_nullable<T>::value && std::is_constructible<T, T&&>::value && - std::is_assignable<T&, T&&>::value)> +template <typename T, bool = (is_nullable<T>::value && std::is_constructible_v<T, T&&> && + std::is_assignable_v<T&, T&&>)> class nullable final { public: using value_type = T; @@ -131,30 +131,26 @@ class nullable<T, true> final { constexpr T& value() & { if (has_value()) { return value_; - } else { - PW_ASSERT(false); } + PW_ASSERT(false); } constexpr const T& value() const& { if (has_value()) { return value_; - } else { - PW_ASSERT(false); } + PW_ASSERT(false); } constexpr T&& value() && { if (has_value()) { return std::move(value_); - } else { - PW_ASSERT(false); } + PW_ASSERT(false); } constexpr const T&& value() const&& { if (has_value()) { return std::move(value_); - } else { - PW_ASSERT(false); } + PW_ASSERT(false); } template <typename U = T> |