diff --git a/debug/assert.hpp b/debug/assert.hpp index 7fa498be..2f12a41e 100644 --- a/debug/assert.hpp +++ b/debug/assert.hpp @@ -75,6 +75,21 @@ constexpr bool debug_enabled = false; } while (0) +#define RETURN_FALSE_UNLESS(CONDITION) { \ + if (const auto &__return_false_unless = (CONDITION); !__return_false_unless) { \ + if constexpr (debug_enabled) { \ + std::cerr << __FILE__ << ':' \ + << __LINE__ << ':' \ + << __PRETTY_FUNCTION__ << "; " \ + << #CONDITION << '\n'; \ + breakpoint (); \ + } \ + \ + return false; \ + } \ +} while (0) + + #define WARN_RETURN(CONDITION,VALUE) do { \ if (const auto& __warn_return = (CONDITION); !!__warn_return) { \ if constexpr (debug_enabled) { \