strange CFTE issue

Boris-Barboris via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 9 15:15:26 PDT 2017


On Sunday, 9 April 2017 at 16:44:41 UTC, ag0aep6g wrote:

> Or you can make it a template value parameter [2] with type 
> `string[]`:
>
> ----
> string[] sfilter(T, string[] fields)()
> {
>     string[] result;
>     foreach (f; aliasSeqOf!fields)
>     {
>         /* ... loop body as you have it ... */
>     }
>     return result;
> }
> ----

Thank you, I didn't even expect it was possible, array as a 
template parameter is quite foreign to me after C++.

> Function parameters are never usable in static contexts.

   Good to know, thank you. So, there are no exceptions to this, 
even when parameter is very simple numeric type value?


More information about the Digitalmars-d-learn mailing list