Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
May 08, 2008 whay dosn;t this template work? | ||||
---|---|---|---|---|
| ||||
T[] RemoveAt(T)(ref T[] dat, int i) { dat = dat[0..i] ~ dat[i+1..$]; } char[][] args args.RemoveAt(0); (D v1) |
May 08, 2008 nevre mind | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | Reply to Benjamin,
> T[] RemoveAt(T)(ref T[] dat, int i)
> {
> dat = dat[0..i] ~ dat[i+1..$];
> }
> char[][] args
>
> args.RemoveAt(0);
>
> (D v1)
>
T RemoveAt(T)(ref T dat, int i)
{
return dat = dat[0..i] ~ dat[i+1..$];
}
|
May 09, 2008 Re: whay dosn;t this template work? | ||||
---|---|---|---|---|
| ||||
Posted in reply to BCS | On Thu, 8 May 2008 22:14:06 +0000 (UTC), BCS <ao@pathlink.com> wrote:
>
>T[] RemoveAt(T)(ref T[] dat, int i)
>{
> dat = dat[0..i] ~ dat[i+1..$];
>}
>
>
>char[][] args
>
>args.RemoveAt(0);
>
>(D v1)
>
The function should return an array.
T[] RemoveAt(T)(ref T[] dat, int i)
{
dat = dat[0..i] ~ dat[i+1..$];
return dat;
}
or
void RemoveAt(T)(ref T[] dat, int i)
{
dat = dat[0..i] ~ dat[i+1..$];
}
|
Copyright © 1999-2021 by the D Language Foundation