← Back to team overview

dolfin team mailing list archive

Re: Mesh iterators

 

On Tue, Feb 10, 2009 at 09:52:20AM +0000, Garth N. Wells wrote:
> I know that we discussed const and mesh iterators a while ago, but can 
> someone remind me why I can't do
> 
>    void myfunction(const Cell& cell) const
>    {
>        for (VertexIterator vertex(cell); !vert.end(); ++vert)
>        {
> 	 . . . .
>        }
>    }
> 
> but have to do
> 
>    void myfunction(const Cell& cell) const
>    {
>        for (VertexIterator vertex(const_cast<Cell&>(cell)); !vert.end(); 
> 
>             ++vert)
>        {
> 	 . . . .
>        }
>    }
> 
> instead?

You shouldn't have to. The class VertexIterator takes a const Cell
argument:

  VertexIterator(const MeshEntity& entity) : MeshEntityIterator(entity, 0) {}

This is at the bottom of Vertex.h.

Push it to sandbox/misc and I'll look at it.

-- 
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups

References