Re: Is there a way to tell if an auto ref parameter is by ref or by value?

2020-05-09 Thread Anonymouse via Digitalmars-d-learn
On Sunday, 10 May 2020 at 00:33:07 UTC, NaN wrote: Ie something like.. auto Foo(T)(auto ref T x) { static if (isByRef(x)) { } else { } } __traits(isRef, x)

Is there a way to tell if an auto ref parameter is by ref or by value?

2020-05-09 Thread NaN via Digitalmars-d-learn
Ie something like.. auto Foo(T)(auto ref T x) { static if (isByRef(x)) { } else { } }

Re: How does a free list work?

2020-05-09 Thread Simen Kjærås via Digitalmars-d-learn
On Saturday, 9 May 2020 at 19:54:44 UTC, Pavel Shkadzko wrote: I have been reading about memory management in D on https://wiki.dlang.org/Memory_Management and found an example of a free list (pattern?): "Free lists are a great way to accelerate access to a frequently allocated and discarded

Challenge

2020-05-09 Thread Jack Applegame via Digitalmars-d-learn
I recently came across an interesting exercise. Given a series of positive numbers, each of which belongs to the set { 2^^i * 3^^j * 5^^k | i, j, k ≥ 0 }. The series is ordered in ascending order. The beginning looks like this: { 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, ... }

How does a free list work?

2020-05-09 Thread Pavel Shkadzko via Digitalmars-d-learn
I have been reading about memory management in D on https://wiki.dlang.org/Memory_Management and found an example of a free list (pattern?): "Free lists are a great way to accelerate access to a frequently allocated and discarded type.". Here is the example of free list:

Re: Is is a Bug or just me?

2020-05-09 Thread bauss via Digitalmars-d-learn
On Friday, 8 May 2020 at 14:16:10 UTC, foerdi wrote: Hi d community, I got a strange behavior since dmd 2.090 (dmd 2.089 is the last working version). See this reduced code: https://run.dlang.io/is/yoyHXC I would expect that foo() returns 2. My guess in foo is: The return value of val is

Re: Get months / years between two dates.

2020-05-09 Thread bauss via Digitalmars-d-learn
On Thursday, 7 May 2020 at 11:40:36 UTC, WebFreak001 wrote: On Wednesday, 6 May 2020 at 19:51:01 UTC, bauss wrote: How do you exactly do that? Like if I have two dates as std.datetime.DateTime How will I get the months or years between the two dates? I was surprised to learn that Duration

Re: Arsd dom.d examples

2020-05-09 Thread Adam D. Ruppe via Digitalmars-d-learn
On Saturday, 9 May 2020 at 16:10:37 UTC, ByR wrote: Are there are tutorials or examples on how to manipulate HTML using dom.d? Replace tag, text, end so on. ByR I don't think so really. There's a wee bit of documentation here http://dpldocs.info/experimental-docs/arsd.dom.html but for the

Arsd dom.d examples

2020-05-09 Thread ByR via Digitalmars-d-learn
Are there are tutorials or examples on how to manipulate HTML using dom.d? Replace tag, text, end so on. ByR

Re: How to port C++ std::is_reference to D ?

2020-05-09 Thread Per Nordlöw via Digitalmars-d-learn
On Wednesday, 6 May 2020 at 17:46:28 UTC, Q. Schroll wrote: C++'s decision to make references part of the type has some advantages, but D didn't do it because of many disadvantages. Can you outline or give a link describing the advantages of C++'s vs D's choice in this matter?

Re: XMM Intrinsics

2020-05-09 Thread Olivier Pisano via Digitalmars-d-learn
On Friday, 8 May 2020 at 12:38:51 UTC, Marcio Martins wrote: Hi, I am building a CRC32C implementation using SSE for D, because I couldn't find any readily available :[ Here is mine: https://github.com/opisano/crc32c/blob/master/crc32c.d