Variable cannot be read at compile time.

aliak something at something.com
Fri Dec 8 00:45:05 UTC 2017


Hi, I'm having a bit a trouble doing some compile time parsing. 
This works:

immutable str = "he-.llo-the.re";
immutable separators = "-.";
enum a = str.splitter(separators).array;

But this does not:

enum b = str.splitter!(a => separators.canFind(a)).array;

The error is: cannot deduce function from argument types !((a) => 
separators.canFind(a))(immutable(string))

And this does:

enum c = str.splitter!(a => a == a).array;

And this does not:

enum d = str.splitter!(a => a == separators).array;

What am I missing?

Thanks!




More information about the Digitalmars-d-learn mailing list