refactor(example): ref qualifiers added to a conversion operator of validated_type

This commit is contained in:
Mateusz Pusz
2023-03-29 16:46:34 +02:00
parent bdbf2c37f8
commit 4dca00617c

View File

@@ -61,12 +61,17 @@ public:
{
}
constexpr explicit(false) operator T() const noexcept(std::is_nothrow_copy_constructible_v<T>)
constexpr explicit(false) operator T() const & noexcept(std::is_nothrow_copy_constructible_v<T>)
requires std::copyable<T>
{
return value_;
}
constexpr explicit(false) operator T() && noexcept(std::is_nothrow_move_constructible_v<T>)
{
return std::move(value_);
}
constexpr T& value() & noexcept = delete;
constexpr const T& value() const& noexcept { return value_; }
constexpr T&& value() && noexcept { return std::move(value_); }