On 09/22/2014 07:07 PM, AsmMan wrote:
I have this array:
static immutable string[] months = ["jan", "fev", ...];
I need to pass it into canFind(). But it doesn't works with immutables
so I need to cast it like in canFind(cast(string[]) months, month) to
work. There's a reason related to design why it doesn't work with
immutables or a function just wasn't written?
What I want to know is if I'm doing something wrong in casting it to
work. I know from C which such casts should be done carefully
What is the compiler version? The following works with dmd git head:
import std.algorithm;
static immutable string[] months = ["jan", "fev" ];
void main()
{
assert(months.canFind("jan"));
}
If it still doesn't work for you please show us a minimal program that
demonstrates the problem.
Ali