morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::math::DecimalPlaces Struct Reference

Strong type for a decimal-precision count. More...

#include <rational.hpp>

Public Member Functions

constexpr DecimalPlaces (std::uint32_t raw) noexcept
 Explicit so a bare integer never silently becomes a precision.
constexpr auto operator<=> (const DecimalPlaces &other) const noexcept=default
 Value ordering/equality on the raw digit count.

Public Attributes

std::uint32_t value {}
 Raw digit count. Rational's invariant keeps it in [0, kMaxDecimalPlaces].

Detailed Description

Strong type for a decimal-precision count.

Prevents the precision from being confused with a numerator or a denominator at a call site: Rational{1, 3, DecimalPlaces{9}}.

Definition at line 121 of file rational.hpp.

Constructor & Destructor Documentation

◆ DecimalPlaces()

morph::math::DecimalPlaces::DecimalPlaces ( std::uint32_t raw)
inlineexplicitconstexprnoexcept

Explicit so a bare integer never silently becomes a precision.

Parameters
rawThe digit count to box.

Definition at line 129 of file rational.hpp.

Member Function Documentation

◆ operator<=>()

auto morph::math::DecimalPlaces::operator<=> ( const DecimalPlaces & other) const
nodiscardconstexprdefaultnoexcept

Value ordering/equality on the raw digit count.

Parameters
otherPrecision to compare against.
Returns
The ordering of the two raw counts.

Member Data Documentation

◆ value

std::uint32_t morph::math::DecimalPlaces::value {}

Raw digit count. Rational's invariant keeps it in [0, kMaxDecimalPlaces].

Definition at line 123 of file rational.hpp.


The documentation for this struct was generated from the following file: