Thread overview
Can not understand this code.
Oct 25, 2019
lili
Oct 25, 2019
berni44
Oct 25, 2019
kinke
October 25, 2019
Hi:
What is the alias Min = xxx mean? why need defined a alias Min in Min template?
```
template Min(alias pred, Args...)
if (Args.length > 0 && __traits(isTemplate, pred))
{
    static if (Args.length == 1)
    {
        alias Min = Alias!(Args[0]);
    }
    else static if (isLess!(pred, Args[1], Args[0]))
    {
        alias Min = Min!(pred, Args[1], Args[2 .. $]);
    }
    else
    {
        alias Min = Min!(pred, Args[0], Args[2 .. $]);
    }
}

```
October 25, 2019
On Friday, 25 October 2019 at 06:40:19 UTC, lili wrote:
> Hi:
> What is the alias Min = xxx mean? why need defined a alias Min in Min template?
> ```
> template Min(alias pred, Args...)
> if (Args.length > 0 && __traits(isTemplate, pred))
> {
>     static if (Args.length == 1)
>     {
>         alias Min = Alias!(Args[0]);
>     }
>     else static if (isLess!(pred, Args[1], Args[0]))
>     {
>         alias Min = Min!(pred, Args[1], Args[2 .. $]);
>     }
>     else
>     {
>         alias Min = Min!(pred, Args[0], Args[2 .. $]);
>     }
> }
>
> ```

I can't explain in detail, but I know, this is called an eponymous template.
See https://dlang.org/spec/template.html#implicit_template_properties
October 25, 2019
On Friday, 25 October 2019 at 06:40:19 UTC, lili wrote:
> why need defined a alias Min in Min template?

https://dlang.org/spec/template.html#implicit_template_properties