Does remove immutability using cast to pass in a function make sense?

kiran kumari via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 23 23:52:05 PDT 2014


On Tuesday, 23 September 2014 at 02:07:09 UTC, 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

see more example
http://techgurulab.com/course/java-quiz-online/


More information about the Digitalmars-d-learn mailing list