mp_units::castable

Checks whether a quantity of quantity spec From can be cast to quantity spec To

Synopsis

Declared in <mp-units/framework/quantity_spec_conversion.h>

template<
    QuantitySpec From,
    QuantitySpec To>
[[nodiscard]]
consteval
bool
castable(
    From from,
    To to);

Description

castable is a weaker requirement than explicitly_convertible and is used to validate quantities belonging to the same kind but with otherwise unrelated equations.

Return Value

true if from can be cast to to

NOTE

The return value should not be discarded.

Template Parameters

NameDescription
Fromsource quantity specification type
Totarget quantity specification type

Parameters

NameDescription
fromsource quantity specification value
totarget quantity specification value