]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Tensor::operator[] should always return by reference.
authorJean-Paul Pelteret <jppelteret@gmail.com>
Fri, 8 Jan 2016 22:36:09 +0000 (23:36 +0100)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Fri, 8 Jan 2016 22:51:02 +0000 (23:51 +0100)
One of the access operators returned by value, instead of by reference.

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

index 0e879fb5cff7958c81e35a39d5e9b88cb6280530..372805040d5800b883f73f2e447c59a152046077 100644 (file)
@@ -198,6 +198,12 @@ inconvenience this causes.
 <a name="general"></a>
 <h3>General</h3>
 <ol>
+  <li> Fixed: Tensor::operator[] that takes TableIndices as a parameter no
+  longer returns by value, but rather by reference.
+  <br>
+  (Jean-Paul Pelteret, 2016/01/08)
+  </li>
+
   <li> New: constrained_linear_operator() and constrained_right_hand_side()
   provide a generic mechanism of applying constraints to a LinearOperator.
   A detailed explanation with example code is given in the @ref constraints
index 125f964860b1d30f5be26a5d695dc8abc68b8a4c..7aa7c52fc50a4f2e829b7a10218464cd0528a676 100644 (file)
@@ -415,7 +415,7 @@ public:
   /**
    * Read access using TableIndices <tt>indices</tt>
    */
-  Number operator [] (const TableIndices<rank_> &indices) const;
+  const Number &operator [] (const TableIndices<rank_> &indices) const;
 
   /**
    * Read and write access using TableIndices <tt>indices</tt>
@@ -887,7 +887,7 @@ Tensor<rank_,dim,Number>::operator[] (const unsigned int i) const
 
 template <int rank_, int dim, typename Number>
 inline
-Number
+const Number &
 Tensor<rank_,dim,Number>::operator[] (const TableIndices<rank_> &indices) const
 {
   Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor<rank_,0,Number>"));

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.