Function rcpputils::assert_true

Function Documentation

inline void rcpputils::assert_true(bool condition, const std::string &msg = "assertion failed")

Assert that a condition passes.

This function behaves similar to assert, except that it throws instead of invoking abort(). It is only enabled when NDEBUG is not defined

Parameters:
  • condition[in] condition to check whether it’s true or not

  • msg[in] message to pass to exception when condition is not met.

Throws:

rcpputils::AssertionException – if the macro NDEBUG is not set and the condition is not met.