Re: Structure of Arrays vs Array of Structures

2017-05-15 Thread Nordlöw via Digitalmars-d-learn
On Monday, 15 May 2017 at 06:50:04 UTC, Nicholas Wilson wrote: Yes, https://maikklein.github.io/post/soa-d/ Ok, great. Thanks. I can't seem to find any Github code repo, tough. Does it exist?

Re: Structure of Arrays vs Array of Structures

2017-05-15 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 15 May 2017 at 06:44:53 UTC, Nordlöw wrote: After having watched Jonathan Blow's talk on Jai https://www.youtube.com/watch?v=TH9VCN6UkyQ=2880s I realized that we should add his Array-of-Structures (AoS) concept to Phobos, preferrably in std.typecons.StructArrays, as something like

Structure of Arrays vs Array of Structures

2017-05-15 Thread Nordlöw via Digitalmars-d-learn
After having watched Jonathan Blow's talk on Jai https://www.youtube.com/watch?v=TH9VCN6UkyQ=2880s I realized that we should add his Array-of-Structures (AoS) concept to Phobos, preferrably in std.typecons.StructArrays, as something like template StructArrays(Members...) { struct

Re: Do array literals still always allocate?

2017-05-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/14/17 7:40 AM, Nicholas Wilson wrote: On Sunday, 14 May 2017 at 10:18:40 UTC, ag0aep6g wrote: On 05/14/2017 01:57 AM, Nicholas Wilson wrote: 1D arrays it doesn't, 2D or higher it does. What do you mean? This works just fine as well: import std.random; import std.stdio; int[2][2]

Re: Structure of Arrays vs Array of Structures

2017-05-15 Thread Per Nordlöw via Digitalmars-d-learn
On Monday, 15 May 2017 at 07:31:25 UTC, Nordlöw wrote: On Monday, 15 May 2017 at 06:50:04 UTC, Nicholas Wilson wrote: Yes, https://maikklein.github.io/post/soa-d/ Ok, great. Thanks. I can't seem to find any Github code repo, tough. Does it exist? Here's my fixed version of soa-d that

Re: How to write parser?

2017-05-15 Thread crimaniak via Digitalmars-d-learn
On Sunday, 14 May 2017 at 19:00:09 UTC, Suliman wrote: I am trying to learn how to write text parser. I have example doc with follow format: #Header my header text ##SubHeader my sub header text it's there any better way to parse such format? Ready markdown Pegged based parser:

Re: Structure of Arrays vs Array of Structures

2017-05-15 Thread Nordlöw via Digitalmars-d-learn
On Monday, 15 May 2017 at 17:10:49 UTC, Per Nordlöw wrote: On Monday, 15 May 2017 at 07:31:25 UTC, Nordlöw wrote: On Monday, 15 May 2017 at 06:50:04 UTC, Nicholas Wilson wrote: Yes, https://maikklein.github.io/post/soa-d/ Ok, great. Thanks. I can't seem to find any Github code repo, tough.

Re: avoid extra variable during void pointer cast

2017-05-15 Thread Bauss via Digitalmars-d-learn
On Sunday, 14 May 2017 at 21:07:36 UTC, Marco Leise wrote: Am Sun, 14 May 2017 20:18:24 + schrieb Kevin Brogan : [...] No, that is not possible. An alias can only be assigned a symbol. [...] Let the compiler optimize the assignment away and don't worry much about

How to move append to an array?

2017-05-15 Thread Yuxuan Shui via Digitalmars-d-learn
Suppose I have a struct A { @disable this(this); } x; How do I append it into an array? Do I have to do array.length++; moveEmplace(x, array[$-1]); ?

No tempFile() in std.file

2017-05-15 Thread Nordlöw via Digitalmars-d-learn
Why isn't there a function, say `tempFile()`, in https://dlang.org/phobos/std_file.html that creates a temporary _file_ when we already have https://dlang.org/phobos/std_file.html#tempDir ?

Current LDC Android status

2017-05-15 Thread Mike B Johnson via Digitalmars-d-learn
So what is currently the state of affairs with LDC and android? Last time I remember, it *could* compile to android but barely.

Re: How to move append to an array?

2017-05-15 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 15 May 2017 at 21:38:52 UTC, Yuxuan Shui wrote: Suppose I have a struct A { @disable this(this); } x; How do I append it into an array? Do I have to do array.length++; moveEmplace(x, array[$-1]); ? moveEmplace is for moving an initialized object into an uninitialized one.

Re: How to move append to an array?

2017-05-15 Thread Yuxuan Shui via Digitalmars-d-learn
On Monday, 15 May 2017 at 23:36:06 UTC, Stanislav Blinov wrote: On Monday, 15 May 2017 at 21:38:52 UTC, Yuxuan Shui wrote: Suppose I have a struct A { @disable this(this); } x; How do I append it into an array? Do I have to do array.length++; moveEmplace(x, array[$-1]); ? moveEmplace

Re: How to move append to an array?

2017-05-15 Thread Yuxuan Shui via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 01:34:50 UTC, Stanislav Blinov wrote: On Tuesday, 16 May 2017 at 01:22:49 UTC, Yuxuan Shui wrote: Can I expand an array with uninitialized object? Or can I rely on the compiler to optimize the initialization away? Built-in arrays always default-initialize their

Re: Error: unrecognized switch '--DRT-oncycle=print' => where is switch defined?

2017-05-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/15/17 6:37 PM, Timothee Cour via Digitalmars-d-learn wrote: Getting this: ``` Deprecation 16211 warning: A cycle has been detected in your program that was undetected prior to DMD 2.072. This program will continue, but will not operate when using DMD 2.073 to compile. Use runtime option

Error: unrecognized switch '--DRT-oncycle=print' => where is switch defined?

2017-05-15 Thread Timothee Cour via Digitalmars-d-learn
Getting this: ``` Deprecation 16211 warning: A cycle has been detected in your program that was undetected prior to DMD 2.072. This program will continue, but will not operate when using DMD 2.073 to compile. Use runtime option --DRT-oncycle=print to see the cycle details. ``` Where is `

Re: No tempFile() in std.file

2017-05-15 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, May 15, 2017 21:52:27 Nordlöw via Digitalmars-d-learn wrote: > Why isn't there a function, say `tempFile()`, in > > https://dlang.org/phobos/std_file.html > > that creates a temporary _file_ when we already have > > https://dlang.org/phobos/std_file.html#tempDir We have

Re: How to move append to an array?

2017-05-15 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 16 May 2017 at 01:22:49 UTC, Yuxuan Shui wrote: Can I expand an array with uninitialized object? Or can I rely on the compiler to optimize the initialization away? Built-in arrays always default-initialize their elements. If you need something that unsafe, there's

Re: No tempFile() in std.file

2017-05-15 Thread Era Scarecrow via Digitalmars-d-learn
On Monday, 15 May 2017 at 22:38:15 UTC, Jonathan M Davis wrote: Personally, I think that it would be very much worth making hello world larger, since hello world really doesn't matter, but because there are plenty of folks checking out D who write hello world and then look at the executable

Re: Structure of Arrays vs Array of Structures

2017-05-15 Thread Stanislav Blinov via Digitalmars-d-learn
On Monday, 15 May 2017 at 06:50:04 UTC, Nicholas Wilson wrote: On Monday, 15 May 2017 at 06:44:53 UTC, Nordlöw wrote: Have anybody done this already? Yes, https://maikklein.github.io/post/soa-d/ The code in that article is overly simplified. Concrete use cases would require more than