Value of type T with a specified unit or tag type U. More...
#include <eagine/tagged_quantity.hpp>
Public Types | |
using | unit_type = U |
Alias for the unit type. | |
using | value_type = T |
Alias for the value type. | |
Public Member Functions | |
tagged_quantity ()=default | |
Default constructor. | |
constexpr | tagged_quantity (T v) noexcept |
Explicit constructor initializing the value. | |
template<typename X , typename UX , typename = std::enable_if_t< std::is_convertible_v<X, T> && units::is_convertible_v<UX, U>>> | |
constexpr | tagged_quantity (const tagged_quantity< X, UX > &tq) noexcept |
Converting constructor from another tagged quantity. | |
template<typename UX , typename = std::enable_if_t<units::is_convertible_v<U, UX>>> | |
constexpr auto | to () const noexcept |
Conversion to a quantity in another unit type. | |
constexpr auto | value () const noexcept -> T |
Returns the value. | |
template<typename X , typename = std::enable_if_t<std::is_convertible_v<T, X>>> | |
constexpr | operator X () const noexcept |
Brief Explicit conversion of the value to the specified. | |
template<typename X , typename UX , typename = std::enable_if_t< std::is_convertible_v<X, T> && units::is_convertible_v<UX, U>>> | |
auto | operator+= (const tagged_quantity< X, UX > &q) noexcept -> auto & |
Addition of another tagged quantity. | |
template<typename X , typename UX , typename = std::enable_if_t< std::is_convertible_v<X, T> && units::is_convertible_v<UX, U>>> | |
auto | operator-= (const tagged_quantity< X, UX > &q) noexcept -> auto & |
Subtraction of another tagged quantity. | |
Static Public Member Functions | |
static constexpr auto | unit () noexcept -> U |
Returns the unit. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename Qty , typename = std::enable_if_t<is_convertible_quantity_v<Qty, units::radian>>> | |
static constexpr auto | sin (const Qty &qty) |
Overload of sine for quantities of angle. More... | |
template<typename Qty , typename = std::enable_if_t<is_convertible_quantity_v<Qty, units::radian>>> | |
static constexpr auto | cos (const Qty &qty) |
Overload of cosine for quantities of angle. More... | |
template<typename Qty , typename = std::enable_if_t<is_convertible_quantity_v<Qty, units::radian>>> | |
static constexpr auto | tan (const Qty &qty) |
Overload of tangens for quantities of angle. More... | |
template<typename T > | |
static constexpr auto | arcsin (T x) |
Overload of arc sine for quantities of angle. More... | |
template<typename T > | |
static constexpr auto | arccos (T x) |
Overload of arc cosine for quantities of angle. More... | |
template<typename T > | |
static constexpr auto | arctan (T y, T x) |
Overload of tangens for quantities of angle. More... | |
template<typename T1 , typename U1 , typename T2 , typename U2 > | |
constexpr auto | operator== (const tagged_quantity< T1, U1 > &a, const tagged_quantity< T2, U2 > &b) -> std::enable_if_t< units::is_convertible_v< U2, U1 >, bool > |
Equality comparison. | |
template<typename T1 , typename U1 , typename T2 , typename U2 > | |
constexpr auto | operator!= (const tagged_quantity< T1, U1 > &a, const tagged_quantity< T2, U2 > &b) -> std::enable_if_t< units::is_convertible_v< U2, U1 >, bool > |
Nonequality comparison. | |
template<typename T1 , typename U1 , typename T2 , typename U2 > | |
constexpr auto | operator< (const tagged_quantity< T1, U1 > &a, const tagged_quantity< T2, U2 > &b) -> std::enable_if_t< units::is_convertible_v< U2, U1 >, bool > |
Less-than comparison. | |
template<typename T1 , typename U1 , typename T2 , typename U2 > | |
constexpr auto | operator<= (const tagged_quantity< T1, U1 > &a, const tagged_quantity< T2, U2 > &b) -> std::enable_if_t< units::is_convertible_v< U2, U1 >, bool > |
Less-equal comparison. | |
template<typename T1 , typename U1 , typename T2 , typename U2 > | |
constexpr auto | operator> (const tagged_quantity< T1, U1 > &a, const tagged_quantity< T2, U2 > &b) -> std::enable_if_t< units::is_convertible_v< U2, U1 >, bool > |
Greater-than comparison. | |
template<typename T1 , typename U1 , typename T2 , typename U2 > | |
constexpr auto | operator>= (const tagged_quantity< T1, U1 > &a, const tagged_quantity< T2, U2 > &b) -> std::enable_if_t< units::is_convertible_v< U2, U1 >, bool > |
Greater-equal comparison. | |
template<typename T , typename U > | |
constexpr auto | operator+ (const tagged_quantity< T, U > &a) |
Unary plus operator. | |
template<typename T , typename U > | |
constexpr auto | operator- (const tagged_quantity< T, U > &a) |
Unary negation operator. | |
template<typename T1 , typename U1 , typename T2 , typename U2 > | |
constexpr auto | operator+ (const tagged_quantity< T1, U1 > &a, const tagged_quantity< T2, U2 > &b) |
Addition operator. | |
template<typename T1 , typename U1 , typename T2 , typename U2 > | |
constexpr auto | operator- (const tagged_quantity< T1, U1 > &a, const tagged_quantity< T2, U2 > &b) |
Subtraction operator. | |
template<typename T1 , typename U1 , typename T2 , typename U2 > | |
constexpr auto | operator* (const tagged_quantity< T1, U1 > &a, const tagged_quantity< T2, U2 > &b) |
Multiplication operator. | |
template<typename T1 , typename U , typename T2 , typename = std::enable_if_t<!units::is_unit_v<T2> && !is_tagged_quantity_v<T2>>> | |
constexpr auto | operator* (const tagged_quantity< T1, U > &a, const T2 &c) |
Multiplication by constant operator. | |
template<typename T1 , typename T2 , typename U > | |
constexpr auto | operator* (const T1 &c, const tagged_quantity< T2, U > &a) |
Multiplication by constant operator. | |
template<typename T1 , typename U1 , typename U2 , typename = std::enable_if_t<units::is_unit_v<U2>>> | |
constexpr auto | operator* (const tagged_quantity< T1, U1 > &a, U2) |
Multiplication by unit operator. | |
template<typename T1 , typename U1 , typename T2 , typename U2 > | |
constexpr auto | operator/ (const tagged_quantity< T1, U1 > &a, const tagged_quantity< T2, U2 > &b) |
Division operator. | |
template<typename T1 , typename U , typename T2 , typename = std::enable_if_t<!units::is_unit_v<T2>>> | |
constexpr auto | operator/ (const tagged_quantity< T1, U > &a, const T2 &c) |
Division by constant operator. | |
template<typename T1 , typename U1 , typename U2 , typename = std::enable_if_t<units::is_unit_v<U2>>> | |
constexpr auto | operator/ (const tagged_quantity< T1, U1 > &a, U2) |
Constant division operator. | |
Value of type T with a specified unit or tag type U.