From: Matthias Maier Date: Mon, 7 Sep 2015 22:34:47 +0000 (-0500) Subject: Bugfix: Provide const TensorIndicesHelper<>::extract variant X-Git-Tag: v8.4.0-rc2~462^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c14c9a37ade3c5d88a607d87a6327508da1366e;p=dealii.git Bugfix: Provide const TensorIndicesHelper<>::extract variant It is necessary to also deal with const references... --- diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index cec13691a6..4def2b2bbe 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -803,6 +803,15 @@ namespace internal return TensorIndicesHelper::template extract( t[indices[rank - rank_]], indices); } + + template + static inline + const Number &extract(const Tensor &t, const TableIndices &indices) + { + Assert (indices[rank - rank_]::template extract( + t[indices[rank - rank_]], indices); + } }; template<> struct TensorIndicesHelper<1> @@ -814,6 +823,14 @@ namespace internal Assert (indices[rank - 1] + static inline + const Number &extract(const Tensor<1,dim,Number> &t, const TableIndices &indices) + { + Assert (indices[rank - 1]::operator[] (const TableIndices &indices) const { Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor")); Assert (indices[0]::extract(*this, indices); + return internal::TensorIndicesHelper::template extract(*this, indices); } @@ -916,7 +933,7 @@ Tensor::operator[] (const TableIndices &indices) { Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor")); Assert (indices[0]::extract(*this, indices); + return internal::TensorIndicesHelper::template extract(*this, indices); }