[Dune] Notification from Dune
Flyspray
dune at hal.iwr.uni-heidelberg.de
Tue Apr 10 10:29:09 CEST 2007
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
A new Flyspray task has been opened. Details are below.
User who did this: - Oliver Sander (sander)
Attached to Project - Dune
Summary - Constness of BCRSMatrix ignored
Task Type - Bug Report
Category - ISTL
Status - New
Assigned To -
Operating System - All
Severity - Medium
Priority - Normal
Reported Version - SVN
Due in Version -
Due Date - Undecided
Details - Consider the following test case:
#include <config.h>
#include <dune/common/fmatrix.hh>
#include <dune/istl/bcrsmatrix.hh>
using namespace Dune;
void foo(const BCRSMatrix<FieldMatrix<double,1,1> >& matrix)
{
BCRSMatrix<FieldMatrix<double,1,1> >::row_type::iterator it =
matrix[0].begin();
(*it)[0][0] = 42;
}
int main (int argc, char *argv[])
{
BCRSMatrix<FieldMatrix<double,1,1> > bcrsMatrix(1,1,
BCRSMatrix<FieldMatrix<double,1,1> >::random);
bcrsMatrix.setrowsize(0,1);
bcrsMatrix.endrowsizes();
bcrsMatrix.addindex(0, 0);
bcrsMatrix.endindices();
bcrsMatrix = 0;
std::cout << bcrsMatrix[0][0] << std::endl;
foo(bcrsMatrix);
std::cout << bcrsMatrix[0][0] << std::endl;
}
Note that the method foo modifies a const matrix. Not only does this
test case compile, but also the matrix is indeed modified, as can be
seen from the test case output. The reason seems to be in the file
basearray.hh:578, where there is a copy constructor for a non-const
iterator from a const-iterator.
More information can be found at the following URL:
http://hal.iwr.uni-heidelberg.de/flyspray/?do=details&id=282
You are receiving this message because you have requested it from the
Flyspray bugtracking system. You can be removed from future
notifications by visiting the URL shown above.
More information about the Dune
mailing list