#include <Magnum/Math/Unit.h>
template<template<class> class Derived, class T>
Unit class
Base class for units.
Template parameters | |
---|---|
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 new in Git master
- Promotion.
- 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.
-
template<class FloatingPoint>auto operator*=(FloatingPoint number) -> Unit<Derived, T>& new in Git master
- Multiply an integral value with a floating-point number and assign.
-
template<class FloatingPoint>auto operator*(FloatingPoint number) const -> Unit<Derived, T> constexpr new in Git master
- Multiply an integral value with a floating-point 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.
-
template<class FloatingPoint>auto operator/=(FloatingPoint number) -> Unit<Derived, T>& new in Git master
- Divide an integral value with a floating-point number and assign.
-
template<class FloatingPoint>auto operator/(FloatingPoint number) const -> Unit<Derived, T> constexpr new in Git master
- Divide an integral value with a floating-point number.
- auto operator/(Unit<Derived, T> other) const -> T constexpr
- Ratio of two values.
- auto operator%=(Unit<Derived, T> other) -> Unit<Derived, T>& new in Git master
- Do modulo of a value and assign.
- auto operator%(Unit<Derived, T> other) const -> Unit<Derived, T> constexpr new in Git master
- Modulo of a value.
Friends
- auto operator*(T number, Unit<Derived, T> value) -> Unit<Derived, T> constexpr
- Multiply a number with a value.
-
template<class FloatingPoint>auto operator*(FloatingPoint number, const Unit<Derived, T>& value) -> Unit<Derived, T> constexpr new in Git master
- Multiply a floating-point number with an integral value.
Function documentation
template<template<class> class Derived, class T>
Magnum:: Math:: Unit<Derived, T>:: Unit() constexpr noexcept
Default constructor.
Equivalent to Unit(ZeroInitT).
template<template<class> class Derived, class T>
Unit<Derived, T> Magnum:: Math:: Unit<Derived, T>:: operator+() const constexpr new in Git master
Promotion.
Returns the value as-is.
template<template<class> class Derived, class T>
template<class FloatingPoint>
Unit<Derived, T>& Magnum:: Math:: Unit<Derived, T>:: operator*=(FloatingPoint number) new in Git master
Multiply an integral value with a floating-point number and assign.
Similar to operator*=(T), except that the multiplication is done in floating-point.
template<template<class> class Derived, class T>
template<class FloatingPoint>
Unit<Derived, T> Magnum:: Math:: Unit<Derived, T>:: operator*(FloatingPoint number) const constexpr new in Git master
Multiply an integral value with a floating-point number.
Similar to operator*(T) const, except that the multiplication is done in floating-point.
template<template<class> class Derived, class T>
template<class FloatingPoint>
Unit<Derived, T>& Magnum:: Math:: Unit<Derived, T>:: operator/=(FloatingPoint number) new in Git master
Divide an integral value with a floating-point number and assign.
Similar to operator/
template<template<class> class Derived, class T>
template<class FloatingPoint>
Unit<Derived, T> Magnum:: Math:: Unit<Derived, T>:: operator/(FloatingPoint number) const constexpr new in Git master
Divide an integral value with a floating-point number.
Similar to operator/(T) const, except that the division is done in floating-point.
template<template<class> class Derived, class T>
Unit<Derived, T>& Magnum:: Math:: Unit<Derived, T>:: operator%=(Unit<Derived, T> other) new in Git master
Do modulo of a value and assign.
Enabled only for integral types.
template<template<class> class Derived, class T>
Unit<Derived, T> Magnum:: Math:: Unit<Derived, T>:: operator%(Unit<Derived, T> other) const constexpr new in Git master
Modulo of a value.
Enabled only for integral types.
template<template<class> class Derived, class T>
Unit<Derived, T> operator*(T number,
Unit<Derived, T> value) constexpr
Multiply a number with a value.
Same as operator*(T) const.
template<template<class> class Derived, class T>
template<class FloatingPoint>
Unit<Derived, T> operator*(FloatingPoint number,
const Unit<Derived, T>& value) constexpr new in Git master
Multiply a floating-point number with an integral value.
Same as operator*(FloatingPoint) const.