| Thread overview | |||||
|---|---|---|---|---|---|
|
December 14, 2015 Where dynamic array remove function to go? | ||||
|---|---|---|---|---|
| ||||
Dynamic Arrays Socket[] a; a ~= new Socket; a ~= new Socket; a ~= new Socket; a.remove(1); Error: function core.stdc.stdio.remove (const(char*) filename) is not callable using argument types (Socket[], uint) why? | ||||
December 13, 2015 Re: Where dynamic array remove function to go? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to master | On 12/13/2015 07:15 PM, master wrote: > Dynamic Arrays > Socket[] a; > > a ~= new Socket; > a ~= new Socket; > a ~= new Socket; > > a.remove(1); > > Error: function core.stdc.stdio.remove (const(char*) filename) is not > callable using argument types (Socket[], uint) That message references stdio. It looks like you forgot to import std.algorithm: http://dlang.org/phobos/std_algorithm_mutation.html#.remove Also note that a.remove(1) returns a range, a is not modified in any way. You may want to do this: a = a.remove(1); Lastly, remember the D.learn newsgroup. ;) Ali | |||
December 14, 2015 Re: Where dynamic array remove function to go? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Ali Çehreli | On Monday, 14 December 2015 at 03:35:13 UTC, Ali Çehreli wrote:
> On 12/13/2015 07:15 PM, master wrote:
>> Dynamic Arrays
>> Socket[] a;
>>
>> a ~= new Socket;
>> a ~= new Socket;
>> a ~= new Socket;
>>
>> a.remove(1);
>>
>> Error: function core.stdc.stdio.remove (const(char*) filename) is not
>> callable using argument types (Socket[], uint)
>
> That message references stdio. It looks like you forgot to import std.algorithm:
>
> http://dlang.org/phobos/std_algorithm_mutation.html#.remove
>
> Also note that a.remove(1) returns a range, a is not modified in any way. You may want to do this:
>
> a = a.remove(1);
>
> Lastly, remember the D.learn newsgroup. ;)
>
> Ali
haha, thank you very much, have been found, I do not care
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply