mp_units::constraint_violation_handler

Customization point for handling domain constraint violations.

Synopsis

Declared in <mp-units/framework/customization_points.h>
template<typename Rep>
struct constraint_violation_handler;

Description

The library calls constraint_violation_handler<Rep>::on_violation(msg) when a domain constraint is violated (e.g., out-of-bounds value, non-negativity).

No default implementation is provided. When no specialization exists for a given Rep, the library uses MP_UNITS_EXPECTS directly (which may compile to nothing in release builds). Specializing this trait opts the type into guaranteed enforcement.

Template Parameters

Name Description
Rep the representation type