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

Carsten Gräser graeser at mi.fu-berlin.de
Thu Sep 3 16:07:36 CEST 2015


Hi,

Am 03.09.2015 um 13:34 schrieb Oliver Sander:
> Am 03.09.2015 um 13:29 schrieb Christian Engwer:
>> Hi Oli,
>>
>> I think for master this is a good appraoch. I assume that Atgeirr has
>> to support dune 2.4 as well and thus we also need a version which
>> works with the older compilers.
but even the old ones that we support allow decltype.
We already use it in several places. However, ...

> I'm only speaking about master.  As for 2.4, I'd rather avoid patches that change template
> lookup behavior this late in the release process. 
... I'm with Oliver here. And I would not merge such changes
unless it's really necessary for fixing a real bug. But it
seems that Atgeirrs problem is already fixed.

Best,
Carsten

> Best,
> Oliver
> 
>>
>> Christian
>>
>> On Thu, Sep 03, 2015 at 01:21:26PM +0200, Oliver Sander wrote:
>>> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.dune-project.org/pipermail/dune-devel/attachments/20150903/813574c3/attachment.sig>


More information about the Dune-devel mailing list