diff --git a/example/include/validated_type.h b/example/include/validated_type.h index 5e63f792..08b08d82 100644 --- a/example/include/validated_type.h +++ b/example/include/validated_type.h @@ -61,6 +61,17 @@ public: { } + +#if UNITS_COMP_MSVC && UNITS_COMP_MSVC < 1930 + + constexpr explicit(false) operator T() const noexcept(std::is_nothrow_copy_constructible_v) + requires std::copyable + { + return value_; + } + +#else + constexpr explicit(false) operator T() const& noexcept(std::is_nothrow_copy_constructible_v) requires std::copyable { @@ -72,6 +83,8 @@ public: return std::move(value_); } +#endif + constexpr T& value() & noexcept = delete; constexpr const T& value() const& noexcept { return value_; } constexpr T&& value() && noexcept { return std::move(value_); }