From 300055a8048b4c14be7a702f09c0fb41e7185a7c Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Wed, 14 Nov 2007 00:17:24 +0000 Subject: [PATCH] New AssertIndexRange to abbreviate these assertions git-svn-id: https://svn.dealii.org/trunk@15494 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/exceptions.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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, -- 2.39.5