From edfbf831a77820fcb37f8c418f3d7c1c0c6ef861 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 17 Sep 2015 12:47:54 -0500 Subject: [PATCH] Convert static_assert to Assert --- include/deal.II/base/tensor.h | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index fe219184cb..931377dc2e 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -1515,12 +1515,11 @@ typename Tensor &src1, const Tensor &src2) { -#ifdef DEAL_II_WITH_CXX11 - static_assert(0 <= index_1 && index_1 < rank_1, - "The specified index_1 must lie within the range [0,rank_1)"); - static_assert(0 <= index_2 && index_2 < rank_2, - "The specified index_2 must lie within the range [0,rank_2)"); -#endif + Assert(0 <= index_1 && index_1 < rank_1, + ExcMessage("The specified index_1 must lie within the range [0,rank_1)")); + Assert(0 <= index_2 && index_2 < rank_2, + ExcMessage("The specified index_2 must lie within the range [0,rank_2)")); + using namespace TensorAccessors; using namespace TensorAccessors::internal; @@ -1579,16 +1578,19 @@ typename Tensor &src1, const Tensor &src2) { -#ifdef DEAL_II_WITH_CXX11 - static_assert(0 <= index_1 && index_1 < rank_1, - "The specified index_1 must lie within the range [0,rank_1)"); - static_assert(0 <= index_3 && index_3 < rank_1, - "The specified index_3 must lie within the range [0,rank_1)"); - static_assert(0 <= index_2 && index_2 < rank_2, - "The specified index_2 must lie within the range [0,rank_2)"); - static_assert(0 <= index_4 && index_4 < rank_2, - "The specified index_4 must lie within the range [0,rank_2)"); -#endif + Assert(0 <= index_1 && index_1 < rank_1, + ExcMessage("The specified index_1 must lie within the range [0,rank_1)")); + Assert(0 <= index_3 && index_3 < rank_1, + ExcMessage("The specified index_3 must lie within the range [0,rank_1)")); + Assert(index_1 != index_3, + ExcMessage("index_1 and index_3 must not be the same")); + Assert(0 <= index_2 && index_2 < rank_2, + ExcMessage("The specified index_2 must lie within the range [0,rank_2)")); + Assert(0 <= index_4 && index_4 < rank_2, + ExcMessage("The specified index_4 must lie within the range [0,rank_2)")); + Assert(index_2 != index_4, + ExcMessage("index_2 and index_4 must not be the same")); + using namespace TensorAccessors; using namespace TensorAccessors::internal; -- 2.39.5