optional_throw.hpp
Like emp_assert, but throws a runtime error if compiled with -DEMP_OPTIONAL_THROW_ON.
This file is part of Empirical, https://github.com/devosoft/Empirical Copyright (C) 2024 Michigan State University MIT Software license; see doc/LICENSE.md
Useful if you want the option to throw a runtime error outside of debug mode. A common use case is wrapping C++ code in Python, since segfaults kill the entire Python interpreter.
Defines
-
INCLUDE_EMP_BASE_OPTIONAL_THROW_HPP_GUARD
-
emp_optional_throw(...)
NDEBUG should trigger its EMP equivalent.
Require a specified condition to be true. If it is false, immediately halt execution. Print also extra information on any variables or expressions provided as variadic args. Note: If NDEBUG is defined, emp_assert() will not do anything. Due to macro parsing limitations, extra information will not be printed when compiling with MSVC.