Added assert_throw macro.

release/4.3a0
Richard Roberts 2013-07-04 03:20:37 +00:00
parent 57f682998c
commit 6a6e7d012b
1 changed files with 11 additions and 0 deletions

View File

@ -103,6 +103,17 @@ namespace gtsam {
operator T() const { return value; }
};
/** An assertion that throws an exception if NDEBUG is not defined and
* evaluates to an empty statement otherwise. */
#ifdef NDEBUG
#define assert_throw(CONDITION, EXCEPTION) ((void)0)
#else
#define assert_throw(CONDITION, EXCEPTION) \
if(!(CONDITION)) { \
throw (EXCEPTION); \
}
#endif
}
#ifdef _MSC_VER