template<template<class> class Derived, class T>
Magnum::Math::Unit class

Base class for units.

Template parameters
Derived
T Underlying data type

Public types

using Type = T
Underlying data type.

Constructors, destructors, conversion operators

Unit(ZeroInitT = ZeroInit) constexpr noexcept
Construct zero value.
Unit(NoInitT) explicit noexcept
Construct without initializing the contents.
Unit(T value) explicit constexpr noexcept
Explicit conversion from unitless type.
template<class U>
Unit(Unit<Derived, U> value) explicit constexpr noexcept
Construct from another underlying type.
Unit(const Unit<Derived, T>& other) noexcept defaulted constexpr
Copy constructor.
operator T() const explicit constexpr
Explicit conversion to underlying type.

Public functions

auto operator==(Unit<Derived, T> other) const -> bool constexpr
Equality comparison.
auto operator!=(Unit<Derived, T> other) const -> bool constexpr
Non-equality comparison.
auto operator<(Unit<Derived, T> other) const -> bool constexpr
Less than comparison.
auto operator>(Unit<Derived, T> other) const -> bool constexpr
Greater than comparison.
auto operator<=(Unit<Derived, T> other) const -> bool constexpr
Less than or equal comparison.
auto operator>=(Unit<Derived, T> other) const -> bool constexpr
Greater than or equal comparison.
auto operator-() const -> Unit<Derived, T> constexpr
Negated value.
auto operator+=(Unit<Derived, T> other) -> Unit<Derived, T>&
Add and assign value.
auto operator+(Unit<Derived, T> other) const -> Unit<Derived, T> constexpr
Add value.
auto operator-=(Unit<Derived, T> other) -> Unit<Derived, T>&
Subtract and assign value.
auto operator-(Unit<Derived, T> other) const -> Unit<Derived, T> constexpr
Subtract value.
auto operator*=(T number) -> Unit<Derived, T>&
Multiply with number and assign.
auto operator*(T number) const -> Unit<Derived, T> constexpr
Multiply with number.
auto operator/=(T number) -> Unit<Derived, T>&
Divide with number and assign.
auto operator/(T number) const -> Unit<Derived, T> constexpr
Divide with number.
auto operator/(Unit<Derived, T> other) const -> T constexpr
Ratio of two values.