]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Tensor::operator<< for dim==0 now accesses values by reference. 2047/head
authorJean-Paul Pelteret <jppelteret@gmail.com>
Fri, 8 Jan 2016 23:26:28 +0000 (00:26 +0100)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Fri, 8 Jan 2016 23:26:28 +0000 (00:26 +0100)
This is done instead of making a copy, and is useful when non-trivial
number types (e.g. auto-differentiable) are stored.

doc/news/changes.h
include/deal.II/base/tensor.h

index 372805040d5800b883f73f2e447c59a152046077..7e93d38360110c0a3417dad7268e921c58454a03 100644 (file)
@@ -199,7 +199,9 @@ inconvenience this causes.
 <h3>General</h3>
 <ol>
   <li> Fixed: Tensor::operator[] that takes TableIndices as a parameter no
-  longer returns by value, but rather by reference.
+  longer returns by value, but rather by reference. Tensor::operator<< for
+  dim==0 now accesses values by reference instead of making a copy. This is
+  useful when non-trivial number types are stored.
   <br>
   (Jean-Paul Pelteret, 2016/01/08)
   </li>
index 7aa7c52fc50a4f2e829b7a10218464cd0528a676..3a240f5d53c18b328133629d5625f2ae8e13ff18 100644 (file)
@@ -1192,7 +1192,7 @@ template <int dim, typename Number>
 inline
 std::ostream &operator << (std::ostream &out, const Tensor<0,dim,Number> &p)
 {
-  out << static_cast<Number>(p);
+  out << static_cast<const Number &>(p);
   return out;
 }
 

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.