Skip to content

mp_units::utility::unspecified

The default of a customization point that has no usable default

Synopsis

Declared in <mp-units/utility/unspecified.h>

inline constexpr unspecified_t unspecified = {};

Description

A variable template can't be deleted the way a function can, so a customization point that has to be specialized before use starts as unspecified, and a specialization replaces it. Code then accepts only the types it was specialized for:

struct lidar {};

// the unit a sensor reports in, known only for the sensors registered for it
template<typename Sensor>
constexpr auto native_unit = utility::unspecified;

template<>
inline constexpr auto native_unit<lidar> = mm;

template<typename Sensor>
  requires utility::specified<decltype(native_unit<Sensor>)>
quantity<native_unit<Sensor>, int> read(const Sensor& sensor);

The library's own customization points, such as tensor_order and radian_of, start this way.

See Also

  • specified for testing whether a customization point has a value