ADL

Manu via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 3 08:57:08 PDT 2016


On 3 September 2016 at 22:42, Andrei Alexandrescu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 9/3/16 1:51 AM, Manu via Digitalmars-d wrote:
>>
>> I've
>> never thought about this problem in C++, or had any problems with ADL.
>
>
> How do you swap two objects of a generic type that may or may not define its
> own swap? -- Andrei

It's not a problem I've ever had. I'm not actually quite sure I
understand your question... I guess this is sort of like the issue I
was alluding to in my other thread though; there exists a generic
implementation, but some type requires to specialise for itself, which
then needs to trump the otherwise ambiguous conflict with the
catch-all? I think that's an interesting problem, but it's quite easy
to solve with an (ugly) forwarding template; but that forwawrding
template leads right back here, where the worker `doThingImpl()` as
implemented for each type that supports 'doThing' depends on ADL to be
callable from the master `doThing()` function.


More information about the Digitalmars-d mailing list