www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - whay dosn;t this template work?

reply BCS <ao pathlink.com> writes:
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
next sibling parent BCS <ao pathlink.com> writes:
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 08 2008
prev sibling parent Max Samukha <nospam nospam.com> writes:
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..$]; }
May 09 2008