tupleof on arrays?

Yang Bo pop.atry at gmail.com
Tue Oct 16 23:22:43 PDT 2007


Yang Bo 写道:
> 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 ?

I forget the n.stringof, it should be:

template S(int n) {
  const char[] S = "n = " ~ n.stringof;
}
void f() {
  char[S!(123).length] s = [S!(0).tupleof];
  s[0] = 'm';
}



More information about the Digitalmars-d mailing list