#757 Error using VTKWriter
Metadata
Property | Value |
---|---|
Reported by | Atgeirr Flø Rasmussen (atgeirr@sintef.no) |
Reported at | Mar 12, 2010 11:54 |
Type | Bug Report |
Version | Git (pre2.4) [autotools] |
Operating System | Unspecified / All |
Last edited by | Christian Engwer (christi@conan.iwr.uni-heidelberg.de) |
Last edited at | Feb 13, 2011 21:33 |
Closed by | Christian Engwer (christi@conan.iwr.uni-heidelberg.de) |
Closed at | Feb 13, 2011 21:33 |
Closed in version | Unknown |
Resolution | Fixed |
Comment | was already fixed in dune-grid r6852 |
Description
The class VertexIterator inherits ForwardIteratorFacade<VertexIterator, Entity, Entity&, int> and its method dereference() returns an Entity&.
I think that it should be a const iterator, since the grid is not changed by the VTKWriter. I get compilation failures of the following flavour:
/Users/atgeirr/dune_scratch_with_ALU_debug/dune-common/dune/common/iteratorfacades.hh:189: error: invalid initialization of reference of type 'Dune::cpgrid::Entity<0, Dune::CpGrid>&' from expression of type 'const Dune::cpgrid::Entity<0, Dune::CpGrid>'
I have tried to fix this by changing the above mentioned occurrences of Entity to const Entity, and it seems to work (but if there is a better way, I don't know). Output from svn diff follows:
Index: dune/grid/io/file/vtk/vtkwriter.hh
--- dune/grid/io/file/vtk/vtkwriter.hh (revision 6406) +++ dune/grid/io/file/vtk/vtkwriter.hh (working copy) @@ -252,7 +252,7 @@ }
class VertexIterator :
-
public ForwardIteratorFacade<VertexIterator, Entity, Entity&, int>
-
public ForwardIteratorFacade<VertexIterator, const Entity, const Entity&, int>
-
Entity& dereference() const
-
const Entity& dereference() const { return *git; }