Vector Swizzling in D

Don Clugston dac at nospam.com
Wed Mar 14 10:35:05 PDT 2012


On 14/03/12 15:57, Boscop wrote:
> Hi everyone,
>
> I wrote a blog post for people who know a bit of D and want to dig
> deeper, it shows different approaches to get vector swizzling syntax in D:
>
> http://boscop.tk/blog/?p=1
>
> There is nothing revolutionary involved but it might still be useful to
> someone.
> Comments and criticism are welcome.
>
In the last bit of code, why not use CTFE for valid(string s) instead of 
templates?

bool valid(string s)
{
    foreach(c; s)
    {
      if (c < 'w' || c > 'z') return false;
    }
    return true;
}

In fact you can use CTFE for the other template functions as well.



More information about the Digitalmars-d-learn mailing list