trap_exception
Description This exception policy will trap at compile time any operation that COULD result in a runtime exception. It can be used in an environment which can tolerate neither arithmetic errors nor runtime overhead. Usage of this policy will almost always require altering one's program to avoid exceptions.
Model of ExceptionPolicy
Header #include <boost/safe_numerics/exception_policy.hpp>
Example of use #include "../../include/safe_integer.hpp" #include "../../include/automatic.hpp" #include "../../include/exception_policies.hpp" int main(){ using namespace boost::numeric; safe<char, automatic, trap_exception> x, y; y = x * x; // compile error here !!! auto z = x * x; // compile OK return 0; }