From: Jean-Paul Pelteret Date: Fri, 8 Jan 2016 22:36:09 +0000 (+0100) Subject: Tensor::operator[] should always return by reference. X-Git-Tag: v8.4.0-rc2~104^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d836a4dbe5033ecef4d32e2a26d59753c24d4340;p=dealii.git Tensor::operator[] should always return by reference. One of the access operators returned by value, instead of by reference. --- diff --git a/doc/news/changes.h b/doc/news/changes.h index 0e879fb5cf..372805040d 100644 --- a/doc/news/changes.h +++ b/doc/news/changes.h @@ -198,6 +198,12 @@ inconvenience this causes.

General

    +
  1. Fixed: Tensor::operator[] that takes TableIndices as a parameter no + longer returns by value, but rather by reference. +
    + (Jean-Paul Pelteret, 2016/01/08) +
  2. +
  3. 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 diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 125f964860..7aa7c52fc5 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -415,7 +415,7 @@ public: /** * Read access using TableIndices indices */ - Number operator [] (const TableIndices &indices) const; + const Number &operator [] (const TableIndices &indices) const; /** * Read and write access using TableIndices indices @@ -887,7 +887,7 @@ Tensor::operator[] (const unsigned int i) const template inline -Number +const Number & Tensor::operator[] (const TableIndices &indices) const { Assert(dim != 0, ExcMessage("Cannot access an object of type Tensor"));