How do I create a char[] from a const(char)[]?
Dan
murpsoft at hotmail.com
Sat Dec 22 15:35:26 PST 2007
I have a const(char)[] string being passed in as a parameter (can't change that) and I want to create a duplicate that is not const.
I tried all manner of things that would make sense to dispose of the constness of it. It's looking though that I will have to actually loop through and cast every freaking character?
void myfunc(const(char)[] sin){
char[] sout = cast(char[]) sin; // nope
char[] sout = cast(char[]) sin.dup; // nope
char[] sout = (cast(char[]) sin).dup; // nope
What's the trick?
More information about the Digitalmars-d-learn
mailing list