jam 0.0.1
A compacting generational garbage collector for C++26
Loading...
Searching...
No Matches
jam::units::space< Rep, Ratio > Class Template Referenceexport
module jam

A count of storage units; Ratio measures one unit in bytes. Integer arithmetic and conversions terminate on overflow. Floating arithmetic follows its representation. Like chrono, integral destinations accept only lossless unit conversions implicitly; use space_cast, floor, ceil or round otherwise. There is no implicit conversion to an untyped count. More...

Public Types

using rep = Rep
 Count representation.
using ratio = typename Ratio::type

Public Member Functions

constexpr space ()=default
 Default-initialize the representation, as with chrono durations.
template<class R>
requires std::is_arithmetic_v<R> && (std::floating_point<Rep> || !std::floating_point<R>)
constexpr space (R count) noexcept
 Explicitly construct from a count, without implicit float-to-integer loss.
template<class R, class P>
requires (std::floating_point<Rep> || (!std::floating_point<R> && std::ratio_divide<P, ratio>::den == 1))
constexpr space (space< R, P > other) noexcept
 Implicit conversion when the destination can express every source tick.
constexpr rep count () const noexcept
 Retrieve the count in this unit explicitly.
constexpr space operator+ () const noexcept
 Preserve the count.
constexpr space operator- () const noexcept
 Negate the count; unrepresentable negation terminates.
constexpr space & operator++ () noexcept
 Add one unit.
constexpr space operator++ (int) noexcept
 Add one unit, returning the previous count.
constexpr space & operator-- () noexcept
 Subtract one unit.
constexpr space operator-- (int) noexcept
 Subtract one unit, returning the previous count.
constexpr space & operator+= (space other) noexcept
 Add an exactly convertible amount.
constexpr space & operator-= (space other) noexcept
 Subtract an exactly convertible amount.
constexpr space & operator*= (rep scalar) noexcept
 Multiply by a scalar count.
constexpr space & operator/= (rep scalar) noexcept
 Divide by a scalar count.
constexpr space & operator%= (rep scalar) noexcept
 Remainder of an integral count divided by a scalar.
constexpr space & operator%= (space other) noexcept
 Remainder after whole multiples of an amount.

Static Public Member Functions

static constexpr space zero () noexcept
 Zero units.
static constexpr space min () noexcept
 Least representable count.
static constexpr space max () noexcept
 Greatest representable count.

Detailed Description

template<class Rep, class Ratio = std::ratio<1>>
class jam::units::space< Rep, Ratio >

A count of storage units; Ratio measures one unit in bytes. Integer arithmetic and conversions terminate on overflow. Floating arithmetic follows its representation. Like chrono, integral destinations accept only lossless unit conversions implicitly; use space_cast, floor, ceil or round otherwise. There is no implicit conversion to an untyped count.

Definition at line 82 of file units.ccm.

Member Typedef Documentation

◆ ratio

template<class Rep, class Ratio = std::ratio<1>>
using jam::units::space< Rep, Ratio >::ratio = typename Ratio::type

Bytes per unit, in lowest terms.

Definition at line 89 of file units.ccm.


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