[Dune-devel] [Dune] Reference and pointer type when dereferencing EntityPointer

Robert Kloefkorn robertk at posteo.de
Mon Oct 20 11:04:32 CEST 2014


Hello Steffen,

> yes, maybe I should have put up a vote. On the other hand, I asked about this on
> the devel list and the only one who answered was Christian. And his answer was
> basically „Oh, that was probably just a cock-up in the original design, we didn’t
> know better / correctly think about this back then“.

I don't read the mailing list mails every day. And even if I would I
sometimes don't have the time to answer right away. For that reason,
with interface changes, there has to be a grace period. Even though this
is very frustrating for the developer. Otherwise it can be very
frustrating for the others.


> Yes, I’ll put up votes in the future. That said, is there a good reason to keep the non-const
> reference? I don’t even think we really have a choice here because entities are now copyable.
> Think about the following code:
> 
> Entity& e1 = *it1;
> Entity& e2 = *it2;
> e1 = e2;

Christian was right, that this is something from the old times.
We should change it (as you already did) and now that we have it, we
should change all code that fails because of this change.

> What does that do to the internal state of it1?
After your change this should not compile anymore, right?
I think in the future we want something like

Entity e1 = *it1 ;
Entity e2 = *it2 ;

Then e1 = e2 makes sense again. For grids like UGGrid or ALUGrid, where
the Entity class carries a lot of information this can still be
implemented via a proxy class and some smart allocation/deallocation of
Entity objects.

Best,

Robert





More information about the Dune-devel mailing list