Type functions with std.algorithm

Stefan Koch uplink.coder at googlemail.com
Sun Oct 11 16:44:23 UTC 2020


On Sunday, 11 October 2020 at 15:46:19 UTC, Stefan Koch wrote:
> On Sunday, 11 October 2020 at 13:49:20 UTC, Stefan Koch wrote:
>>
>> So all I have to do is to teach that the type of any type is 
>> __type.
>>
>> And then everything will work!
>
> Turns out that is not the case now array fails with:
> phobos/std/conv.d(4529): Error: constructor 
> std.conv.emplaceRef!(__type, __type, 
> __type).emplaceRef.S.this(ref __type _param_0) is not callable 
> using argument types ((__type))
>
> I believe this is an implicit conversion problem ...

Wow this is so strange ...
lvalue to ref conversion works just fine.

The code below works ... but what else could be going on here?
---
alias type = __type;

type ret(type x)
{
     alias y = x;
     y = passthrough(y);
     return y;
}

type passthrough(ref type y)
{
     return y;
}

pragma(msg, ret(int)); // prints int
---





More information about the Digitalmars-d mailing list