JayBeams  0.1
Another project to have fun coding.
assert_throw.hpp
Go to the documentation of this file.
1 #ifndef jb_assert_throw_hpp
2 #define jb_assert_throw_hpp
3 
4 #include <stdexcept>
5 
6 namespace jb {
7 
8 /**
9  * Raise std::exception to indicate an assertion failure
10  */
11 [[noreturn]] void raise_assertion_failure(
12  char const* filename, int lineno, char const* predicate);
13 
14 #define JB_ASSERT_THROW(PRED) \
15  do { \
16  if (not(PRED)) { \
17  ::jb::raise_assertion_failure(__FILE__, __LINE__, #PRED); \
18  } \
19  } while (false)
20 
21 } // namespace jb
22 
23 #endif // jb_assert_throw_hpp
void raise_assertion_failure(char const *filename, int lineno, char const *predicate)
Raise std::exception to indicate an assertion failure.
Definition: assert_throw.cpp:6
The top-level namespace for the JayBeams library.
Definition: as_hhmmss.hpp:7