#include <Magnum/Math/Unit.h>
template<template<class> class Derived, class T>
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() constexpr noexcept
- Default constructor.
- Unit(ZeroInitT) explicit constexpr noexcept
- Construct a zero value.
-
Unit(Magnum::
NoInitT) explicit noexcept - Construct without initializing the contents.
- Unit(T value) explicit constexpr noexcept
- Explicit conversion from a unitless type.
-
template<class U>Unit(Unit<Derived, U> value) explicit constexpr noexcept
- Construct from another underlying type.
- 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 a value.
- auto operator+(Unit<Derived, T> other) const -> Unit<Derived, T> constexpr
- Add a value.
- auto operator-=(Unit<Derived, T> other) -> Unit<Derived, T>&
- Subtract and assign a value.
- auto operator-(Unit<Derived, T> other) const -> Unit<Derived, T> constexpr
- Subtract a value.
- auto operator*=(T number) -> Unit<Derived, T>&
- Multiply with a number and assign.
- auto operator*(T number) const -> Unit<Derived, T> constexpr
- Multiply with a number.
- auto operator/=(T number) -> Unit<Derived, T>&
- Divide with a number and assign.
- auto operator/(T number) const -> Unit<Derived, T> constexpr
- Divide with a number.
- auto operator/(Unit<Derived, T> other) const -> T constexpr
- Ratio of two values.
Function documentation
template<template<class> class Derived, class T>
Magnum:: Math:: Unit<Derived, T>:: Unit() constexpr noexcept
Default constructor.
Equivalent to Unit(ZeroInitT).