From d836a4dbe5033ecef4d32e2a26d59753c24d4340 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Fri, 8 Jan 2016 23:36:09 +0100 Subject: [PATCH] Tensor::operator[] should always return by reference. One of the access operators returned by value, instead of by reference. --- doc/news/changes.h | 6 ++++++ include/deal.II/base/tensor.h | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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")); -- 2.39.5