Template Struct type_caster< Karana::Math::QuantityOrValue< Value > >

Template Struct type_caster< Karana::Math::QuantityOrValue< Value > >#

Struct Documentation#

template<typename Value>
struct type_caster<Karana::Math::QuantityOrValue<Value>>#

Converts every QuantityOrValue between C++ and Pint.

Template Parameters:

Value – The scalar, vector, or matrix magnitude type.

Public Functions

PYBIND11_TYPE_CASTER(type, casterName)#

Type caster for pint quantities and associated C++ values.

inline bool load(handle src, bool convert)#

Converts a Pint quantity or bare Python magnitude to C++.

Parameters:
  • src – The source Python object.

  • convert – Whether implicit conversions are allowed.

Returns:

True when the source has the expected dimension and value shape.

Public Static Functions

static inline handle cast(const type &src, return_value_policy policy, handle parent)#

Converts a C++ value to a Python value.

Parameters:
  • src – The source C++ value.

  • policy – The pybind11 return-value policy for the magnitude.

  • parent – The parent Python object, when applicable.

Returns:

A new reference to the resulting Python value.