```
import std.stdio;
void main(){
auto a=new int[][] (0,0);
a~=[1,2];
a~=[3,4];
auto b= a.dup;
a[0]=[5,6];
a[1][1]=7;
writeln(b);
}
```
Program above outputs [[1, 2], [3, 7]]
Which means a[1][1] and b[1][1] point to the same memory location.
But a[0] occupies a different memory location as
On Wednesday, 2 June 2021 at 15:32:38 UTC, Sean wrote:
...
You can implement deep copy using template recursion:
import std;
T[] rdup(T : U[], U)(T[] duped) {
return duped.map!(arr => arr.rdup).array;
}
T[] rdup(T)(T[] duped) {
return duped.dup;
}
On Tuesday, 1 June 2021 at 20:56:05 UTC, someone wrote:
On Tuesday, 1 June 2021 at 16:20:19 UTC, Ola Fosheim Grøstad
wrote:
[...]
I wasn't considering/referring to content in the browser, this
is an entirely different arena.
[...]
Thank you! I can only agree.
On 6/3/21 9:00 AM, kdevel wrote:
a) What is the rationale behind not making byLineCopy the default?
byLine was the original implementation. byLineCopy was added later
after the need for it became apparent.
See:
https://forum.dlang.org/post/lg4l7s$11rl$1...@digitalmars.com
THX. BTW
a) What is the rationale behind not making byLineCopy the
default?
byLine was the original implementation. byLineCopy was added
later after the need for it became apparent.
See:
https://forum.dlang.org/post/lg4l7s$11rl$1...@digitalmars.com
THX. BTW byLineCopy defaults to immutable char.
On Wednesday, 2 June 2021 at 17:50:13 UTC, Sean wrote:
On Wednesday, 2 June 2021 at 15:32:38 UTC, Sean wrote:
if so, how can I get the behavior i am searching for? Thank
you.
My current solution, if anyone wonders :
https://github.com/patefacio/d-help/blob/master/d-help/opmix/dup.d
You may
On Thursday, 3 June 2021 at 10:18:25 UTC, kdevel wrote:
a) What is the rationale behind not making byLineCopy the
default?
byLine was the original implementation. byLineCopy was added
later after the need for it became apparent.
On Thursday, 3 June 2021 at 10:30:24 UTC, Mike Parker wrote:
On Thursday, 3 June 2021 at 10:18:25 UTC, kdevel wrote:
a) What is the rationale behind not making byLineCopy the
default?
byLine was the original implementation. byLineCopy was added
later after the need for it became apparent.
On Thursday, 3 June 2021 at 01:22:14 UTC, Paul Backus wrote:
auto tmp = File(filename).byLine();
`File.byLine` overwrites the previous line's data every time it
reads a new line. If you want to store each line's data for
later use, you need to use [`byLineCopy`][1] instead.
On Thursday, 3 June 2021 at 00:39:04 UTC, vacuum_tube wrote:
I've been trying to make a struct for CSV parsing and
manipulating. The code was as follows:
```
struct CSVData(bool HeaderFromFirstLine)
{
char[][] header = [];
char[][][] rest = [];
```
[...]
additionally to the
10 matches
Mail list logo