Banuba SDK
assert.hpp
1 #pragma once
2 
3 #include <cassert>
4 #include <bnb/utils/exceptions.hpp>
5 
6 /**
7  * @addtogroup Utils
8  * @{
9  */
10 
11 #define BNB_ASSERT(expr) assert(expr)
12 #define BNB_ASSERT_MSG(expr, msg) assert((expr) && (msg))
13 
14 #define BNB_CHECK(expr) \
15  if (!(expr)) { \
16  BNB_THROW(std::logic_error, #expr); \
17  }
18 
19 #define BNB_CHECK_MSG(expr, msg) \
20  if (!(expr)) { \
21  BNB_THROW(std::logic_error, std::string(msg) + ": " + #expr); \
22  }
23 
24 /** @} */ // endgroup utils