|
constexpr | quantity () noexcept |
|
template<typename Value > |
constexpr | quantity (Value val) noexcept |
| Default constructor used to create a physical quantity from value. More...
|
|
constexpr ValueType | operator* () const noexcept |
| Const reference to the internal value. More...
|
|
constexpr Derived & | operator+= (quantity const other) noexcept |
| Add other quantity of same Derived and value_type. More...
|
|
constexpr Derived & | operator-= (quantity const other) noexcept |
| Subtract other quantity of same Derived and value_type. More...
|
|
constexpr Derived & | operator/= (arithmetic auto const val) noexcept |
| Divides quantity by it's value type. More...
|
|
constexpr Derived & | operator*= (arithmetic auto const val) noexcept |
| Multiplies quantity by it's value type. More...
|
|
template<typename U > |
constexpr | operator U () const noexcept |
| Provides explicit conversion of internal value to type U. More...
|
|
template<typename Derived, typename ValueType = float>
class emlabcpp::quantity< Derived, ValueType >
Class representing generic quantity.
Quantities are types which simply overlay basic numeric type (ValueType) and give you abillity to create custom types via CRTP. The C++ type system prevents you from passing values of quantites of different implementation type.
The overlay implements: +=,-= +,- ==, != <,>,>=,<= abs, max, min Quantity can be multiplied or divided by it's ValueType - /,*,/=,*= Additionally, we support these operations over quantity: cos, sin
Credits should go to https://github.com/joboccara/NamedType as I inspired by project by this blogger!