Who wore it better?

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Apr 25 07:10:33 PDT 2016


On 4/24/16 6:40 AM, Nick Treleaven wrote:
> On Friday, 15 April 2016 at 18:46:01 UTC, Steven Schveighoffer wrote:
>> inout(T)[] overlap(T)(inout(T)[] r1, inout(T)[] r2)
>
> Might be nice if inout applied to template parameter types:
>
> T[] overlap(inout T)(T[] r1, T[] r2);
>
> If it wasn't for the virtual function issue, I wonder if inout would
> still be needed on runtime arguments given the above feature?

The only issue is that overlap being passed a mutable T[] could modify 
the data. This is the major deficiency with the template solution. As 
I've said before, if you don't care about advertisement of non-mutation, 
then inout doesn't really do much for you.

-Steve


More information about the Digitalmars-d mailing list