[Dune] dune-grid does not compile when implementations of EntityPointer and Iterator are not interoperable

Steffen Müthing steffen.muething at ipvs.uni-stuttgart.de
Fri Apr 27 12:08:28 CEST 2012


Hi Dune,

I just noticed that it is not possible to have non-interoperable implementations of EntityPointer and any
of the iterators - doing so will make the compiler choke on the deprecated EntityPointer reference cast.

I stumbled over the problem when I forcibly disabled the interoperability (by specializing EnableIfInteroperable)
to debug an issue in MultiDomainGrid. I was able to make fix the issue (see attached patch), but from the wording
in entitypointer.hh, I really don't know whether or not the compilation is expected to fail for non-interoperable
implementations (as some kind of compile-time safeguard).

That said, being able to disable the possibility to do the reference cast would really simplify the MultiDomainGrid
code quite a bit in a number of places - right now I have the problem that the cast matches rather greedily and I have to
provide pretty elaborate template specializations of constructors and other stuff to work around that.

So, is this intended behavior or should we fix it? Or do we throw out the reference cast for the new release (it was deprecated
in 2.1)?

Best,

Steffen


PS: In order to fix the problem, I had to do some trickery with the cast operator - it can't be disabled using SFINAE, because the return
type *is* the function name. So I did a less than pretty hack and just made it convert to void if the cast is disabled (a marker type like
InvalidCast or something might be nicer).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: entitypointer-cast.patch
Type: application/octet-stream
Size: 1320 bytes
Desc: not available
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20120427/9c95ed59/attachment.obj>
-------------- next part --------------


Steffen Müthing
Universität Stuttgart
Institut für Parallele und Verteilte Systeme
Universitätsstr. 38
70569 Stuttgart
Tel: +49 711 685 88429
Fax: +49 711 685 88340
Email: steffen.muething at ipvs.uni-stuttgart.de





-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 495 bytes
Desc: Signierter Teil der Nachricht
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20120427/9c95ed59/attachment.sig>


More information about the Dune mailing list