Re: how to sort the container Array from std.container

2018-06-08 Thread ag0aep6g via Digitalmars-d-learn
On 06/08/2018 10:52 AM, Flaze07 wrote: ah...well thank you, well...I did finds another way, but it is probably better to use linearRemove I used arr = make!( Array!uint )( remove( arr[], 2 ); so linearRemove is probably better Instead of creating a new array, you could update the length of the

Re: how to sort the container Array from std.container

2018-06-08 Thread Flaze07 via Digitalmars-d-learn
On Wednesday, 6 June 2018 at 14:46:56 UTC, ag0aep6g wrote: On 06/06/2018 04:20 PM, Flaze07 wrote: hmm, and sorry for asking more, what about removing an element from it ? I found no remove operation that can remove from the middle ( removeAny and removeBack both removes the latest element, lin

Re: how to sort the container Array from std.container

2018-06-06 Thread ag0aep6g via Digitalmars-d-learn
On 06/06/2018 04:20 PM, Flaze07 wrote: hmm, and sorry for asking more, what about removing an element from it ? I found no remove operation that can remove from the middle ( removeAny and removeBack both removes the latest element, linearRemove receive Array!uint...which  don't know how to prov

Re: how to sort the container Array from std.container

2018-06-06 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/6/18 10:20 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole wrote: On 07/06/2018 1:58 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 13:46:41 UTC, Adam D. Ruppe wrote: On Wednesday, 6 June 2018 at 13:44:09 UTC, Flaze07 wrote: sort( arr.Range ); don't work,

Re: how to sort the container Array from std.container

2018-06-06 Thread Flaze07 via Digitalmars-d-learn
On Wednesday, 6 June 2018 at 14:29:28 UTC, rikki cattermole wrote: On 07/06/2018 2:27 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 14:24:15 UTC, rikki cattermole wrote: On 07/06/2018 2:20 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole wrote: [...] hmm, and

Re: how to sort the container Array from std.container

2018-06-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 2:27 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 14:24:15 UTC, rikki cattermole wrote: On 07/06/2018 2:20 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole wrote: On 07/06/2018 1:58 AM, Flaze07 wrote: [...] Yes. hmm, and sorry for asking more

Re: how to sort the container Array from std.container

2018-06-06 Thread Flaze07 via Digitalmars-d-learn
On Wednesday, 6 June 2018 at 14:24:15 UTC, rikki cattermole wrote: On 07/06/2018 2:20 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole wrote: On 07/06/2018 1:58 AM, Flaze07 wrote: [...] Yes. hmm, and sorry for asking more, what about removing an element from

Re: how to sort the container Array from std.container

2018-06-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 2:20 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole wrote: On 07/06/2018 1:58 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 13:46:41 UTC, Adam D. Ruppe wrote: On Wednesday, 6 June 2018 at 13:44:09 UTC, Flaze07 wrote: sort( arr.Range ); don't wor

Re: how to sort the container Array from std.container

2018-06-06 Thread Flaze07 via Digitalmars-d-learn
On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole wrote: On 07/06/2018 1:58 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 13:46:41 UTC, Adam D. Ruppe wrote: On Wednesday, 6 June 2018 at 13:44:09 UTC, Flaze07 wrote: sort( arr.Range ); don't work, it says cannot pass RangeT!(Array!ui

Re: how to sort the container Array from std.container

2018-06-06 Thread rikki cattermole via Digitalmars-d-learn
On 07/06/2018 1:58 AM, Flaze07 wrote: On Wednesday, 6 June 2018 at 13:46:41 UTC, Adam D. Ruppe wrote: On Wednesday, 6 June 2018 at 13:44:09 UTC, Flaze07 wrote: sort( arr.Range ); don't work, it says cannot pass RangeT!(Array!uint) as function argument Range is the type, you want the value I

Re: how to sort the container Array from std.container

2018-06-06 Thread Flaze07 via Digitalmars-d-learn
On Wednesday, 6 June 2018 at 13:46:41 UTC, Adam D. Ruppe wrote: On Wednesday, 6 June 2018 at 13:44:09 UTC, Flaze07 wrote: sort( arr.Range ); don't work, it says cannot pass RangeT!(Array!uint) as function argument Range is the type, you want the value I think you can do sort(arr[]) maybe

Re: how to sort the container Array from std.container

2018-06-06 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 6 June 2018 at 13:44:09 UTC, Flaze07 wrote: sort( arr.Range ); don't work, it says cannot pass RangeT!(Array!uint) as function argument Range is the type, you want the value I think you can do sort(arr[]) maybe

how to sort the container Array from std.container

2018-06-06 Thread Flaze07 via Digitalmars-d-learn
I know that sort accepts Range( I am correct right ? ), so, Array!uint arr; //inserts element to arr sort( arr.Range ); don't work, it says cannot pass RangeT!(Array!uint) as function argument

Re: Container Array or tuples Sorting

2017-12-13 Thread Vino via Digitalmars-d-learn
On Wednesday, 13 December 2017 at 15:58:40 UTC, Vino wrote: On Wednesday, 13 December 2017 at 15:16:50 UTC, Vino wrote: Hi All, Request your help, on how to sort a tuple container array, I have raised the same topic in one of the other thread "Tuple Array Sorting" and was addres

Re: Container Array or tuples Sorting

2017-12-13 Thread Vino via Digitalmars-d-learn
On Wednesday, 13 December 2017 at 15:16:50 UTC, Vino wrote: Hi All, Request your help, on how to sort a tuple container array, I have raised the same topic in one of the other thread "Tuple Array Sorting" and was addressed to use standard array rather than container array, and i a

Container Array or tuples Sorting

2017-12-13 Thread Vino via Digitalmars-d-learn
Hi All, Request your help, on how to sort a tuple container array, I have raised the same topic in one of the other thread "Tuple Array Sorting" and was addressed to use standard array rather than container array, and i am not able to find any document or example in the library fo

Re: Question on Container Array.

2017-09-18 Thread Eugene Wissner via Digitalmars-d-learn
On Monday, 18 September 2017 at 11:47:07 UTC, Vino.B wrote: Hi All, Can some one explain me on the below question. Q1: void main (Array!string args) : Why can't we use container array in void main? Q2: What is the difference between the below? insert, insertBack stableI

Question on Container Array.

2017-09-18 Thread Vino.B via Digitalmars-d-learn
Hi All, Can some one explain me on the below question. Q1: void main (Array!string args) : Why can't we use container array in void main? Q2: What is the difference between the below? insert, insertBack stableInsert, stableInsertBack linearInsert, stableLinearInsert, stableLinearInser

Re: Container Array

2017-09-08 Thread Vino.B via Digitalmars-d-learn
converting all my standard array to container array. My program has 5 function and I was able to adopt 4 function to container array, and facing issue with this 1 function. I would like to have all my function to be neither in standard array nor in container array, more over I am facing gc issue in

Re: Container Array

2017-09-08 Thread Vino.B via Digitalmars-d-learn
;, 1)); // Only if Array is really needed: import std.container : Array; auto arr = Array!DirInfo(coSizeDirList("./deleteme", 42)); writeln(arr[]); } Ali Hi Ali, As stated earlier my release 1 code are still using std.array, so now in release 2 i am converting all m

Re: Container Array

2017-09-08 Thread Vino.B via Digitalmars-d-learn
td.container : Array; auto arr = Array!DirInfo(coSizeDirList("./deleteme", 42)); writeln(arr[]); } Ali Hi Ali, As stated earlier my release 1 code are still using std.array, so now in release 2 i am converting all my standard array to container array. My program has 5

Re: Container Array

2017-09-08 Thread Ali Çehreli via Digitalmars-d-learn
On 09/07/2017 11:21 PM, Vino.B wrote: > At last was able to print the output, but i am getting some > "Deprecation" warnings like below and also can you help me in formating > the output to display ulong. > > Output: > Size.d(9): Deprecation: std.container.array.RangeT(A) is not visible > from

Re: Container Array

2017-09-07 Thread Vino.B via Digitalmars-d-learn
On Thursday, 7 September 2017 at 20:47:43 UTC, Ali Çehreli wrote: On 09/07/2017 10:39 AM, Vino.B wrote: > Array!(Tuple!(string, ulong)) coSizeDirList () { You stated the return type explicitly above. > return tuple (dFiles[], Subdata[]); According to the error message, what is bei

Re: Container Array

2017-09-07 Thread Ali Çehreli via Digitalmars-d-learn
On 09/07/2017 10:39 AM, Vino.B wrote: > Array!(Tuple!(string, ulong)) coSizeDirList () { You stated the return type explicitly above. > return tuple (dFiles[], Subdata[]); According to the error message, what is being returned does not have the same type: > Test1.d(27): Error: c

Re: Container Array

2017-09-07 Thread Vino.B via Digitalmars-d-learn
On Thursday, 7 September 2017 at 17:12:14 UTC, Vino.B wrote: On Thursday, 7 September 2017 at 15:07:56 UTC, Vino.B wrote: On Thursday, 7 September 2017 at 14:26:08 UTC, Ali Çehreli wrote: On 09/07/2017 03:56 AM, Vino.B wrote: writeln(coCleanFiles); Access the elements by taking a slice of t

Re: Container Array

2017-09-07 Thread Vino.B via Digitalmars-d-learn
On Thursday, 7 September 2017 at 15:07:56 UTC, Vino.B wrote: On Thursday, 7 September 2017 at 14:26:08 UTC, Ali Çehreli wrote: On 09/07/2017 03:56 AM, Vino.B wrote: writeln(coCleanFiles); Access the elements by taking a slice of the container: writeln(coCleanFiles[]); Ali Hi Ali, T

Re: Container Array

2017-09-07 Thread Vino.B via Digitalmars-d-learn
On Thursday, 7 September 2017 at 14:26:08 UTC, Ali Çehreli wrote: On 09/07/2017 03:56 AM, Vino.B wrote: writeln(coCleanFiles); Access the elements by taking a slice of the container: writeln(coCleanFiles[]); Ali Hi Ali, Thank you very much, was ablee to resolve this issue and now f

Re: Container Array

2017-09-07 Thread Ali Çehreli via Digitalmars-d-learn
On 09/07/2017 03:56 AM, Vino.B wrote: writeln(coCleanFiles); Access the elements by taking a slice of the container: writeln(coCleanFiles[]); Ali

Re: Container Array

2017-09-07 Thread Vino.B via Digitalmars-d-learn
).map!(a => tuple(a.name, a.size)); foreach(d; dFiles) writeln(d[0], "\t", d[1]); } } From, Vino.B Hi, I tried a small code using container array, and the output i get form the code is a below, so can one help me on this issue. Program: impo

Container Array

2017-09-06 Thread Vino.B via Digitalmars-d-learn
HI All, Can some one provide me a example of how to use the std.container.array for the below code. import std.algorithm: filter, map; import std.file: SpanMode, dirEntries, isDir; import std.stdio: writeln; import std.typecons: tuple; import std.array: array; void main () { string[] Filesy

Re: How to apply a function to a container/array ?

2014-10-15 Thread Domingo via Digitalmars-d-learn
Even better would be if phobos provided it out of the box: --- import std.stdio; import std.algorithm; import std.array; import std.string; import std.conv; void stripStringArrayInPlace(T)(T[] ar){for(long i=0, len=ar.length; i < len; ++i) ar[i] = ar[i].strip;} T[] stripStringArray

Re: How to apply a function to a container/array ?

2014-10-15 Thread Domingo via Digitalmars-d-learn
Thanks so much it's a bit more bloated than I was expecting but it works. --- void main() { import std.stdio; import std.algorithm; import std.array; import std.string; import std.conv; auto ar = [" dad ", " blue "]; ar.writeln; auto arStriped = ar.map!strip.a

Re: How to apply a function to a container/array ?

2014-10-15 Thread Ali Çehreli via Digitalmars-d-learn
On 10/15/2014 04:26 PM, Domingo wrote: Ideally I want to use something like this: import std.stdio; import std.string; import std.algorithm; import std.conv; void main() { string[] ar = [" dad ", " blue "]; writeln(typeid(ar)); // a) foreach for purely side-effect expressions:

Re: How to apply a function to a container/array ?

2014-10-15 Thread bearophile via Digitalmars-d-learn
Domingo: Ideally I want to use something like this: - import std.stdio; import std.string; import std.algorithm; import std.conv; void main() { string[] ar = [" dad ", " blue "]; writeln(typeid(ar)); //ar.each(writeln); //ar.map!writeln;

How to apply a function to a container/array ?

2014-10-15 Thread Domingo via Digitalmars-d-learn
Ideally I want to use something like this: - import std.stdio; import std.string; import std.algorithm; import std.conv; void main() { string[] ar = [" dad ", " blue "]; writeln(typeid(ar)); //ar.each(writeln); //ar.map!writeln; //ar.apply!