[Dune] Problem mit EntityPointer

Christian Engwer christi at uni-hd.de
Mon Mar 21 23:07:20 CET 2005


I was thinking a lot and finaly I found out how we could do the
inheritance for EntityPointer.

What you want to do:

void mark(EntityPointer & e);
...
mark(LevelIterator);
mark(LeafIterator);
...
EntityPointer a = grid.lbegin(0);

We could introduce a new wrapper
template <...,class IteratorImp,...> class EntityPointer;

Then we add an inheritance for our FooGrid::???Iterator classes as
follows:

                 FooEntityPointer
                /        |       \ ....
 FooLeafIterator FooLevelIterator Foo...

With some tricks we can then use the wrapper for all descendants of
FooEntityPointer.

I have attached an example of this idea. The tricks are quite nasty
but I think I have enough compile-time checks to be on the safe side.

CU Christian

PS: Can anyone explain me why the segfault case in the example doesn't
    work, but the other one? By the way... with icc you don't even
    need this trick... perhaps we should again read the standard :-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: entitypointer.cc
Type: text/x-c++src
Size: 4145 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20050321/b1756735/attachment.cc>


More information about the Dune mailing list