Re: how to use unknown size of array at compile time for further processing

2017-10-01 Thread thorstein via Digitalmars-d-learn
Replace arrayT ~= rowT; with arrayT ~= rowT.dup; Also, you may want to look into ndslice package [1]. [1] https://github.com/libmir/mir-algorithm Best regards, Ilya Yaroshenko Works! Thanks Ilya. I'll take a look on the difference. Also soon will get bit familiar with the mir-algorithm... B

Re: how to use unknown size of array at compile time for further processing

2017-10-01 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Sunday, 1 October 2017 at 14:23:54 UTC, thorstein wrote: [...] Sorry, I'm still really confused with the results from my function: [...] Replace arrayT ~= rowT; with arrayT ~= rowT.dup; Also, you may want to look into ndslice package [1]. [1] https://github.com/libmir/mir-algorith Bes

Re: how to use unknown size of array at compile time for further processing

2017-10-01 Thread thorstein via Digitalmars-d-learn
Guyes, I obviously made a mistake. Forget my post! Sorry, I'm still really confused with the results from my function: double[][] transp(double[][] array) { double[][] arrayT; double[] rowT; // initialize rowT foreach(i; 0..array.length) { rowT ~= 0; } foreach(col; 0..arra

Re: how to use unknown size of array at compile time for further processing

2017-10-01 Thread thorstein via Digitalmars-d-learn
On Sunday, 1 October 2017 at 13:53:57 UTC, thorstein wrote: Why is that Thanks! Guyes, I obviously made a mistake. Forget my post!

Re: how to use unknown size of array at compile time for further processing

2017-10-01 Thread thorstein via Digitalmars-d-learn
They are not alternatives. They are the only way of doing things. Yes, sounds logic - static arrays require a size before compilation. However, I tried another variation with a totally unexpected result: double[][] transp3(double[][] array) { double[][] arrayT; double[] rowT; // initi

Re: how to use unknown size of array at compile time for further processing

2017-10-01 Thread user456 via Digitalmars-d-learn
On Sunday, 1 October 2017 at 10:07:40 UTC, thorstein wrote: Hi, assumed, I need the size of a dynamic array for further processing, which is unknown at compile time. Below are my example, which doesn't work and two alternatives. [...] They are not alternatives. They are the only way of doin

how to use unknown size of array at compile time for further processing

2017-10-01 Thread thorstein via Digitalmars-d-learn
Hi, assumed, I need the size of a dynamic array for further processing, which is unknown at compile time. Below are my example, which doesn't work and two alternatives. Alternative1: may create large rowT-arrays depending on original array size. Alternative2: overrides rowT after exiting the