tupleof on arrays?
BCS
ao at pathlink.com
Tue Oct 16 23:34:43 PDT 2007
Reply to Yang,
> I have some string generate from template, and I need to dump them to
> stack and modify it. So I write:
>
> template S(int n) {
> const char[] S = "n = " ~ n;
> }
> void f() {
> char[S!(123).length] s = [S!(0).tupleof];
> s[0] = 'm';
> }
> The problem is, there is not a 'tupleof' property on array. Should
> this feature be buildin ?
>
no. What would it return? contents of the array? What would it do with a
non const?
I think you can get the effect you want with a cast ot a slice or maybe both.
also somthing along this line should work.
template S(int n) {
const char[4+n.stringof.length] S = "n = " ~ n.stringof;
}
More information about the Digitalmars-d
mailing list