First life-signs of type functions

Nick Treleaven nick at geany.org
Sun May 10 10:28:17 UTC 2020


On Sunday, 10 May 2020 at 08:39:42 UTC, Nick Treleaven wrote:
>     alias E;
>     while (S.length)
>     {
>         E = S[0];
>         if (Tem!E)
>             return true;
>         S = S[1..$];
>     }
>     return false;

I had assumed that indexing an alias[] with a mutable variable 
wouldn't work. If it does, then I don't even need to mutate S:

bool anySatisfy(alias Tem, alias[] S)
{
     size_t i = 0;
     while (i != S.length)
     {
         if (Tem!(S[i]))
             return true;
         i++;
     }
     return false;
}



More information about the Digitalmars-d mailing list