]> https://gitweb.dealii.org/ - dealii.git/commitdiff
implement operator=() for Tensor<0,...> 5865/head
authorLei Qiao <qiaol618@gmail.com>
Fri, 2 Feb 2018 12:28:06 +0000 (20:28 +0800)
committerLei Qiao <qiaol618@gmail.com>
Wed, 7 Feb 2018 03:50:11 +0000 (11:50 +0800)
include/deal.II/base/tensor.h

index 3664211322fa282ac72377bd5084bc1d2648cd04..e3bc3d3bc10ed601446b0c0f2326338c46ea5daf 100644 (file)
@@ -205,6 +205,11 @@ public:
   template <typename OtherNumber>
   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 <int dim, typename Number>
 template <typename OtherNumber>
 inline
 Tensor<0,dim,Number> &Tensor<0,dim,Number>::operator = (const Tensor<0,dim,OtherNumber> &p)
+{
+  value = internal::NumberType<Number>::value(p);
+  return *this;
+}
+
+
+template <int dim, typename Number>
+inline
+Tensor<0,dim,Number> &Tensor<0,dim,Number>::operator = (const Tensor<0,dim,Number> &p)
 {
   value = p.value;
   return *this;

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.