diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-06-22 18:18:44 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-06-22 18:18:44 +0100 |
| commit | 639b270eed81f7c2627d810057d188e2e8ee67f9 (patch) | |
| tree | 7b8f7628b799dba307f06cf813583d42bdc1838a /nihil.ucl/real.ccm | |
| parent | 09b7a494bd5de24f380095003fb7da4939de43e5 (diff) | |
| download | nihil-639b270eed81f7c2627d810057d188e2e8ee67f9.tar.gz nihil-639b270eed81f7c2627d810057d188e2e8ee67f9.tar.bz2 | |
nihil.ucl: improve construction and comparison
Diffstat (limited to 'nihil.ucl/real.ccm')
| -rw-r--r-- | nihil.ucl/real.ccm | 8 |
1 files changed, 7 insertions, 1 deletions
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{}; |
