Template Struct Quantity#

Struct Documentation#

template<typename Value, typename Tag>
struct Quantity#

Associates a C++ value with physical-quantity metadata for pybind11.

Template Parameters:
  • Value – The scalar, vector, or matrix type holding the magnitude.

  • Tag – The quantity metadata tag used to select Pint units.

Public Types

using ValueType = Value#

Type holding the quantity magnitude.

using TagType = Tag#

Metadata tag describing the physical quantity.

Public Functions

Quantity() = default#

Default constructor used by the pybind11 caster.

inline Quantity(Value magnitude)#

Constructs a quantity from its magnitude.

Parameters:

magnitude – The value to store.

inline operator Value&()#

Converts to a mutable magnitude reference.

Returns:

The stored magnitude.

inline operator const Value&() const#

Converts to a constant magnitude reference.

Returns:

The stored magnitude.

Public Members

Value value = {}#

The magnitude expressed as the selected value type.