The Strange Loop conference
Dmitry Olshansky
dmitry.olsh at gmail.com
Thu Sep 22 11:18:25 PDT 2011
On 22.09.2011 1:53, Timon Gehr wrote:
> On 09/21/2011 11:11 PM, Andrei Alexandrescu wrote:
>> On 9/21/11 3:34 PM, Peter Alexander wrote:
>>> What if foo is a virtual member function? Those can't be templates.
>>
>> Then it would need to take a dynamic Range as parameter, parameterized
>> with the element type.
>>
>
> Would it be a good idea to allow this?
>
> to!Interface(structInstance);
>
> This would work if Struct implicitly fulfills the interface and return a
> class instance that is constructed on the fly and implements the
> interface by forwarding to the struct instance.
>
> foo(to!IInputRange(map!(...)(...)));
There is an adaptTo already in Phobos that does something like that. So
all what's left is screwing some bolts in 'to'.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list