From 8796ce5b208097bb1a0ecd9c9a9728c30b0c66da Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Wed, 13 Oct 2021 15:10:00 +0200 Subject: [PATCH] feat: Add new assertm macro This allows to add a message to the assertion which can improve readability of error diagnostics. --- fairmq/Error.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fairmq/Error.h b/fairmq/Error.h index 9a3464f5..eed0d56b 100644 --- a/fairmq/Error.h +++ b/fairmq/Error.h @@ -9,10 +9,15 @@ #ifndef FAIR_MQ_ERROR_H #define FAIR_MQ_ERROR_H +#include #include #include #include +// Macro copied from https://en.cppreference.com/w/cpp/error/assert +// Use (void) to silent unused warnings. +#define assertm(exp, msg) assert(((void)msg, exp)) + namespace fair::mq { struct RuntimeError : ::std::runtime_error