primitive vector types

Jarrett Billingsley jarrett.billingsley at gmail.com
Sat Feb 21 17:13:27 PST 2009


On Sat, Feb 21, 2009 at 6:37 PM, Christopher Wright <dhasenan at gmail.com> wrote:
> Jarrett Billingsley wrote:
>>
>> On Sat, Feb 21, 2009 at 5:47 PM, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>
>>> Yah, ref on the callee side, or the [] operator without any arguments on
>>> the
>>> caller side.
>>
>> Wait, what?  I wouldn't have expected anything but "ref type[n] foo"
>> on the function parameter to pass byref.  What are you saying here?
>
> void foo(T)(T t) {}
>
> int[5_000_000] i;
> foo(i[]); // foo!(int[]) -- semi-by-reference
> foo(i); // foo!(int[5_000_000]) -- by value

Oh.  See, I don't usually template _everything_ so that didn't cross my mind ;)



More information about the Digitalmars-d mailing list