From 639b270eed81f7c2627d810057d188e2e8ee67f9 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Sun, 22 Jun 2025 18:18:44 +0100 Subject: nihil.ucl: improve construction and comparison --- nihil.ucl/real.ccm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'nihil.ucl/real.ccm') diff --git a/nihil.ucl/real.ccm b/nihil.ucl/real.ccm index d968667..51607f2 100644 --- a/nihil.ucl/real.ccm +++ b/nihil.ucl/real.ccm @@ -36,14 +36,20 @@ export struct real final : object { throw type_mismatch(ucl_type, type()); } + // Create a default-initialised real. + real() + : real(0) + {} + // Create a new real from a value. - real(value_type value) + explicit real(value_type value) : object(noref, ::ucl_object_fromdouble(value)) { if (_object == nullptr) throw error("failed to create UCL object"); } + // Return the value of this real. auto value(this real const &self) -> value_type { auto v = value_type{}; -- cgit v1.2.3