auto ref function parameters in a free function
anonymous via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Aug 3 12:43:53 PDT 2014
On Sunday, 3 August 2014 at 19:30:38 UTC, Vlad Levenfeld wrote:
> On Sunday, 3 August 2014 at 19:26:28 UTC, anonymous wrote:
>> Works for me with dmd versions back to 2.060. What compiler are
>> you using?
>
> dmd 2.065
Here's how I'm testing this:
$ dmd | head -n 1
DMD64 D Compiler v2.065
$ cat less_than.d
bool less_than (T)(auto ref T a, auto ref T b)
{
return a < b;
}
void main()
{
int a = 1, b = 2;
assert(less_than(a, b));
assert(less_than(a, 2));
assert(less_than(1, b));
assert(less_than(1, 2));
}
$ dmd less_than.d && echo ok
ok
If this exact code errors for you, it ... uhh ... could be
platform specific? Are you on Windows?
More information about the Digitalmars-d-learn
mailing list