mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 13:25:45 +02:00
error: introduce THROW_CHECK4, the long-awaited sequel to THROW_CHECK3
Sometimes we need to check constraints on 4 variables at once. It would be nice if variadic macros in C++ were also polymorphic. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
parent
2f14a5a9c7
commit
2e36dd2d58
@ -126,6 +126,13 @@ namespace crucible {
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define THROW_CHECK4(type, value1, value2, value3, value4, expr) do { \
|
||||
if (!(expr)) { \
|
||||
THROW_ERROR(type, #value1 << " = " << (value1) << ", " #value2 << " = " << (value2) << ", " #value3 << " = " << (value3) << ", " #value4 << " = " << (value4) \
|
||||
<< " failed constraint check (" << #expr << ")"); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define THROW_CHECK_BIN_OP(type, value1, op, value2) do { \
|
||||
if (!((value1) op (value2))) { \
|
||||
THROW_ERROR(type, "failed constraint check " << #value1 << " (" << (value1) << ") " << #op << " " << #value2 << " (" << (value2) << ")"); \
|
||||
|
Loading…
x
Reference in New Issue
Block a user