|
jam 0.0.1
A compacting generational garbage collector for C++26
|
Typed storage sizes, conversions and byte literals. More...
Classes | |
| class | space |
| 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... | |
Typedefs | |
| using | kibi = std::ratio<1024> |
| Binary kilo: 1024. | |
| using | mebi = std::ratio<1048576> |
| Binary mega: 1024 squared. | |
| using | gibi = std::ratio<1073741824> |
| Binary giga: 1024 cubed. | |
| using | bytes = space<std::size_t> |
| Whole bytes. | |
| using | kilobytes = space<std::size_t, std::kilo> |
| Thousands of bytes. | |
| using | megabytes = space<std::size_t, std::mega> |
| Millions of bytes. | |
| using | gigabytes = space<std::size_t, std::giga> |
| Billions of bytes. | |
| using | kibibytes = space<std::size_t, kibi> |
| Groups of 1024 bytes. | |
| using | mebibytes = space<std::size_t, mebi> |
| Groups of 1048576 bytes. | |
| using | gibibytes = space<std::size_t, gibi> |
| Groups of 1073741824 bytes. | |
| using | pages = space<std::size_t, std::ratio<JAM_PAGE_BYTES>> |
| Platform pages, fixed at build time. | |
Functions | |
| template<class To, class R, class P> | |
| constexpr To | space_cast (space< R, P > value) noexcept |
| Explicit conversion; fractional integral ticks truncate toward zero. | |
| template<class R1, class P1, class R2, class P2> | |
| constexpr auto | operator<=> (space< R1, P1 > a, space< R2, P2 > b) noexcept |
| Compare amounts without overflowing an integral common-unit conversion. | |
| template<class R1, class P1, class R2, class P2> | |
| constexpr bool | operator== (space< R1, P1 > a, space< R2, P2 > b) noexcept |
| Equal amounts may have different units or representations. | |
| template<class R1, class P1, class R2, class P2> | |
| constexpr auto | operator+ (space< R1, P1 > a, space< R2, P2 > b) noexcept |
| Add amounts in their common unit. | |
| template<class R1, class P1, class R2, class P2> | |
| constexpr auto | operator- (space< R1, P1 > a, space< R2, P2 > b) noexcept |
| Subtract amounts in their common unit. | |
|
template<class R, class P, class S> requires std::is_arithmetic_v<S> | |
| constexpr auto | operator* (space< R, P > a, S b) noexcept |
| Multiply an amount by a scalar, preserving its unit. | |
|
template<class R, class P, class S> requires std::is_arithmetic_v<S> | |
| constexpr auto | operator* (S a, space< R, P > b) noexcept |
| Multiply a scalar by an amount. | |
|
template<class R, class P, class S> requires std::is_arithmetic_v<S> | |
| constexpr auto | operator/ (space< R, P > a, S b) noexcept |
| Divide an amount by a scalar, preserving its unit. | |
| template<class R1, class P1, class R2, class P2> | |
| constexpr auto | operator/ (space< R1, P1 > a, space< R2, P2 > b) noexcept |
| Divide two amounts, producing a dimensionless count. | |
| template<std::integral R, class P, std::integral S> | |
| constexpr auto | operator% (space< R, P > a, S b) noexcept |
| Integral remainder in the original unit. | |
| template<std::integral R1, class P1, std::integral R2, class P2> | |
| constexpr auto | operator% (space< R1, P1 > a, space< R2, P2 > b) noexcept |
| Integral remainder in the common unit. | |
| template<class To, class R, class P> | |
| constexpr To | floor (space< R, P > value) noexcept |
| Greatest whole destination count not exceeding the source. | |
| template<class To, class R, class P> | |
| constexpr To | ceil (space< R, P > value) noexcept |
| Least whole destination count not less than the source. | |
|
template<class To, class R, class P> requires std::integral<typename To::rep> | |
| constexpr To | round (space< R, P > value) noexcept |
| Nearest integral destination count; ties round to even. | |
|
template<class R, class P> requires std::is_signed_v<R> | |
| constexpr auto | abs (space< R, P > value) noexcept |
| Absolute value of a signed amount. | |
| consteval bytes | operator""_B (unsigned long long n) noexcept |
| Bytes. | |
| consteval space< long double, std::ratio< 1 > > | operator""_B (long double n) noexcept |
| Fractional B count. | |
| consteval kilobytes | operator""_kB (unsigned long long n) noexcept |
| Kilobytes. | |
| consteval space< long double, std::kilo > | operator""_kB (long double n) noexcept |
| Fractional kB count. | |
| consteval megabytes | operator""_MB (unsigned long long n) noexcept |
| Megabytes. | |
| consteval space< long double, std::mega > | operator""_MB (long double n) noexcept |
| Fractional MB count. | |
| consteval gigabytes | operator""_GB (unsigned long long n) noexcept |
| Gigabytes. | |
| consteval space< long double, std::giga > | operator""_GB (long double n) noexcept |
| Fractional GB count. | |
| consteval kibibytes | operator""_KiB (unsigned long long n) noexcept |
| Kibibytes. | |
| consteval space< long double, kibi > | operator""_KiB (long double n) noexcept |
| Fractional KiB count. | |
| consteval mebibytes | operator""_MiB (unsigned long long n) noexcept |
| Mebibytes. | |
| consteval space< long double, mebi > | operator""_MiB (long double n) noexcept |
| Fractional MiB count. | |
| consteval gibibytes | operator""_GiB (unsigned long long n) noexcept |
| Gibibytes. | |
| consteval space< long double, gibi > | operator""_GiB (long double n) noexcept |
| Fractional GiB count. | |
Typed storage sizes, conversions and byte literals.