CTFE & template predicates
Robert M. Münch via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon May 4 04:41:23 PDT 2015
On 2015-05-03 23:28:00 +0000, anonymous said:
> You need to turn T into a parameter, so that StaticFilter can set it.
> (And it's really a string again, so I'm renaming to s.)
>
> ----
> template startsNotWithp(string s)
> {
> enum startsNotWithp = startsNotWith!(s, 'p');
> }
> /* Shorthand syntax: enum startsNotWithp(string s) = startsNotWith!(s, 'p'); */
> ----
>
>> alias rules = StaticFilter!(startsNotWithp, org_rules);
Hi, I have one more questions: Is it possible to write something like this?
alias rules = StaticFilter!(startsNotWith(?, 'p'), org_rules);
The ? should be used for every memember of org_rules.
--
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
More information about the Digitalmars-d-learn
mailing list