foreach over split string

JS js.mdnq at gmail.com
Wed Jul 17 07:05:05 PDT 2013


On Wednesday, 17 July 2013 at 14:02:01 UTC, JS wrote:
>
> foreach(n; std.string.split(s, ","))
> {
>     // n can't be read at compile time
> }
>
> using in a ctfe.
>
> How to loop over a string array in a ctfe?


Strange...

The code actually works, but when I use my wrapper template it 
doesn't...

template splitstr(string n, string d = " ") { enum splitstr = 
std.string.split(n, d); }


I guess it has something to do with using an enum as the return 
type?


More information about the Digitalmars-d-learn mailing list