Re: templatized delegate

2017-05-23 Thread Alex via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 16:38:14 UTC, Stanislav Blinov wrote: Ah, now I think I get it. You want to store a single delegate that could be called with different sets of arguments? No, you can't do that: you need an actual delegate instance, and for that, you need to know the signature, at lea

Re: templatized delegate

2017-05-23 Thread Alex via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 18:14:34 UTC, ag0aep6g wrote: Something like this: import core.vararg; import std.meta: AliasSeq, staticMap; import std.traits: isCopyable; struct A { void delegate(...) dg; auto fun(T, U ...)(T t, auto ref U u) { template UncopyableToPointer(

Re: templatized delegate

2017-05-23 Thread ag0aep6g via Digitalmars-d-learn
On 05/23/2017 01:30 PM, Alex wrote: And no, I can't pass it by adress, as I don't know apriori, whether the very parameter which gets the random generator is already a part of the variadic parameters, or a well defined ref parameter. A (run-time) variadic delegate isn't flexible like that. Whe

Re: Structure of Arrays vs Array of Structures

2017-05-23 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 16:48:31 UTC, Nordlöw wrote: On Tuesday, 23 May 2017 at 16:46:18 UTC, Nordlöw wrote: http://forum.dlang.org/post/wvulryummkqtskiwr...@forum.dlang.org Correction; should be: https://github.com/nordlow/phobos-next/blob/a324f16515bd1c3c1185ba0482dae2886d811bb1/src/soa.

Re: Structure of Arrays vs Array of Structures

2017-05-23 Thread Nordlöw via Digitalmars-d-learn
On Monday, 15 May 2017 at 19:52:03 UTC, Nordlöw wrote: soa.d-mixin-143(143,7): Error: variable soa.SOA!(S).SOA.container0LU cannot be further field because it will change the determined SOA size soa.d-mixin-143(143,28): Error: variable soa.SOA!(S).SOA.container1LU cannot be further field becaus

Re: Structure of Arrays vs Array of Structures

2017-05-23 Thread Nordlöw via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 16:46:18 UTC, Nordlöw wrote: http://forum.dlang.org/post/wvulryummkqtskiwr...@forum.dlang.org Correction; should be: https://github.com/nordlow/phobos-next/blob/a324f16515bd1c3c1185ba0482dae2886d811bb1/src/soa.d

Re: templatized delegate

2017-05-23 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 11:45:13 UTC, Alex wrote: On Tuesday, 23 May 2017 at 11:05:09 UTC, Stanislav Blinov wrote: void variadic(Args...)(auto ref Args args) { /* ... */ } This infers whether you pass lvalues or rvalues. If passing further down the chain of such calls is needed, one can use

Re: How to get rid of const / immutable poisoning (and I didn't even want to use them...)

2017-05-23 Thread Kagamin via Digitalmars-d-learn
https://dpaste.dzfl.pl/74d67cfca3e8

Re: Which editor to use for editing DDOCs?

2017-05-23 Thread bachmeier via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 07:40:21 UTC, biocyberman wrote: Adding DDOC support for D Mode require some more work obviously. I will see if I can make some changes to that. For the time being, I would like to know which editors people are using. Or is it a plain black and white editor ? I use

Re: Which editor to use for editing DDOCs?

2017-05-23 Thread bauss via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 07:40:21 UTC, biocyberman wrote: On Monday, 22 May 2017 at 15:33:36 UTC, Russel Winder wrote: [...] Adding DDOC support for D Mode require some more work obviously. I will see if I can make some changes to that. For the time being, I would like to know which editor

Re: templatized delegate

2017-05-23 Thread Alex via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 11:05:09 UTC, Stanislav Blinov wrote: void variadic(Args...)(auto ref Args args) { /* ... */ } This infers whether you pass lvalues or rvalues. If passing further down the chain of such calls is needed, one can use std.functional : fowrard : yes... void variadic

Re: templatized delegate

2017-05-23 Thread Alex via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 10:42:54 UTC, Nicholas Wilson wrote: On Tuesday, 23 May 2017 at 10:30:56 UTC, Alex wrote: On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote: With that kind of variadics, you're not dealing with a template. A (run-time) variadic delegate is an actual delegate, i.

Re: templatized delegate

2017-05-23 Thread 9il via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 10:30:56 UTC, Alex wrote: On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote: With that kind of variadics, you're not dealing with a template. A (run-time) variadic delegate is an actual delegate, i.e. a value that can be passed around. But the variadic stuff is

Re: templatized delegate

2017-05-23 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 10:42:54 UTC, Nicholas Wilson wrote: On Tuesday, 23 May 2017 at 10:30:56 UTC, Alex wrote: On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote: With that kind of variadics, you're not dealing with a template. A (run-time) variadic delegate is an actual delegate, i.

Re: templatized delegate

2017-05-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 10:30:56 UTC, Alex wrote: On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote: With that kind of variadics, you're not dealing with a template. A (run-time) variadic delegate is an actual delegate, i.e. a value that can be passed around. But the variadic stuff is

Re: templatized delegate

2017-05-23 Thread Alex via Digitalmars-d-learn
On Monday, 22 May 2017 at 21:44:17 UTC, ag0aep6g wrote: With that kind of variadics, you're not dealing with a template. A (run-time) variadic delegate is an actual delegate, i.e. a value that can be passed around. But the variadic stuff is a bit weird to use, and probably affects performance.

Re: Which editor to use for editing DDOCs?

2017-05-23 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2017-05-23 at 07:40 +, biocyberman via Digitalmars-d-learn wrote: > […] > Adding DDOC support for D Mode require some more work obviously. > I will see if I can make some changes to that. For the time > being, I would like to know which editors people are using. Or is > it a plain b

Re: Which editor to use for editing DDOCs?

2017-05-23 Thread biocyberman via Digitalmars-d-learn
On Monday, 22 May 2017 at 15:33:36 UTC, Russel Winder wrote: On Mon, 2017-05-22 at 14:14 +, biocyberman via Digitalmars-d-learn wrote: Which one do you use? I am using Linux and Emacs for editing other D source file. But the DDOC syntaxes and keywords are not well high-lighted. There has

Re: [OT] #define

2017-05-23 Thread Andrew Edwards via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 00:14:43 UTC, Mike Parker wrote: On Monday, 22 May 2017 at 18:44:10 UTC, Andrew Edwards wrote: There isn't any Windows specific section. Every function pointer in the library is decorated in one of the following two forms void (APIENTRY *NAME)(PARAMS) or

Re: trait detecting anonymous union?

2017-05-23 Thread Bastiaan Veelo via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 01:02:59 UTC, Vladimir Panteleev wrote: On Monday, 22 May 2017 at 21:03:42 UTC, Bastiaan Veelo wrote: Is there a way to detect at CT that S has overlapping data members, when an anonimous union is used as above? I have an implementation here: https://github.com/Cybe

Re: trait detecting anonymous union?

2017-05-23 Thread Bastiaan Veelo via Digitalmars-d-learn
On Monday, 22 May 2017 at 22:11:15 UTC, Stanislav Blinov wrote: On Monday, 22 May 2017 at 21:03:42 UTC, Bastiaan Veelo wrote: Is there a way to detect at CT that S has overlapping data members, when an anonimous union is used as above? There isn't a built-in one. The best I can muster at 1AM

Re: "if" is not evaluated for fields of Class.tupleof

2017-05-23 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 23 May 2017 at 06:42:55 UTC, Timoses wrote: The easiest way is probably casting: ``` import std.traits; import std.bitmanip; class Test { byte[4] marray; byte mbyte; } void main() { auto value = [0x12, 0x23, 0x34, 0x45, 0x56]; auto test = cast(Test*) value.ptr; } ``