From: Guido Kanschat Date: Wed, 14 Nov 2007 00:17:24 +0000 (+0000) Subject: New AssertIndexRange to abbreviate these assertions X-Git-Tag: v8.0.0~9605 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=300055a8048b4c14be7a702f09c0fb41e7185a7c;p=dealii.git New AssertIndexRange to abbreviate these assertions git-svn-id: https://svn.dealii.org/trunk@15494 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/base/include/base/exceptions.h b/deal.II/base/include/base/exceptions.h index 99ef2988be..ccbb20de67 100644 --- a/deal.II/base/include/base/exceptions.h +++ b/deal.II/base/include/base/exceptions.h @@ -919,6 +919,20 @@ namespace StandardExceptions #define AssertDimension(dim1,dim2) Assert((dim1) == (dim2), \ ExcDimensionMismatch((dim1),(dim2))) +/** + * Special assertion for index range of nonnegative indices. + * + * Since this is used very often and always repeats the arguments, we + * introduce this special assertion for ExcIndexRange in order + * to keep the user codes shorter. + * + * Called wit arguments index and range it asserts + * that index<range and throws + * ExcIndexRange(index,0,range) if it fails. + */ +#define AssertIndexRange(index,range) Assert((index) < (range), \ + ExcIndexRange((index),0,(range))) + /* * Unfortunately, the following must be repeated for each library,