[Dune-devel] [PATCH] Use unqualified calls to allow ADL.

Oliver Sander oliver.sander at tu-dresden.de
Thu Sep 3 13:21:26 CEST 2015


Hi,
> Thank you for your explanation, I have tested this and think it can work,
> so consider this patch withdrawn. In our case the abs() function does not
> return a double, but an Evaluation object, so to make things work we have
> to set real_type to Evaluation. Do you see any pitfalls with this? It is not always
> easy to tell what a particular type name is supposed to be used for: at least
> real_type is used for the return value of math functions like abs(), sqrt() and also
> for norms. For those uses I think the model supports our Evaluation class well
> enough (we should return Evaluation from all those functions).
Isn't this one of those cases where the new C++11 return type deduction should
save us a lot of hassle?  Instead of (paraphrasing)

real_type abs()
{
  return magic_abs();
}

write

auto abs() --> decltype(magic_abs())
{
  return magic_abs();
}

As far as I know compiler support for this is good enough (and in fact I have used
it in dune-istl without getting any complaints yet).

Best,
Oliver


>
> Part of the confusion on my part was due to the fact that the ADL-enabling call
> to abs() is a very recent change to Dune, and until recently I was using the
> 2.3 branch. Happy to see it in 2.4!
>
> Atgeirr
>
>
>
>
> _______________________________________________
> Dune-devel mailing list
> Dune-devel at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20150903/536b0326/attachment.htm>


More information about the Dune-devel mailing list