From: Lei Qiao Date: Fri, 2 Feb 2018 12:28:06 +0000 (+0800) Subject: implement operator=() for Tensor<0,...> X-Git-Tag: v9.0.0-rc1~453^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5865%2Fhead;p=dealii.git implement operator=() for Tensor<0,...> --- diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 3664211322..e3bc3d3bc1 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -205,6 +205,11 @@ public: template Tensor<0,dim,Number> &operator = (const Tensor<0,dim,OtherNumber> &rhs); + /** + * Assignment from tensors with same underlying scalar type. + */ + Tensor &operator = (const Tensor<0,dim,Number> &rhs); + /** * This operator assigns a scalar to a tensor. This obviously requires * that the @p OtherNumber type is convertible to @p Number. @@ -798,6 +803,15 @@ template template inline Tensor<0,dim,Number> &Tensor<0,dim,Number>::operator = (const Tensor<0,dim,OtherNumber> &p) +{ + value = internal::NumberType::value(p); + return *this; +} + + +template +inline +Tensor<0,dim,Number> &Tensor<0,dim,Number>::operator = (const Tensor<0,dim,Number> &p) { value = p.value; return *this;