Re: Shortest way to allocate an array and initialize it with a specific value.

2015-06-10 Thread Low Functioning via Digitalmars-d-learn
On Wednesday, 10 June 2015 at 20:22:18 UTC, Adel Mamin wrote: ubyte[5] a = 0xAA; // Fine. Five 0xAA bytes. auto a2 = new ubyte[5]; // Fine. Five 0 bytes. Now, let's say, I want to allocate an array of a size, derived at run time, and initialize it to some non-zero value at the same time. What

Re: Why do std.traits use template foo(args...) instead of foo(alias arg) ?

2014-12-18 Thread Low Functioning via Digitalmars-d-learn
On Thursday, 18 December 2014 at 15:48:02 UTC, Mathias LANG wrote: An exemple being fullyQualifiedName: https://github.com/D-Programming-Language/phobos/blob/master/std/traits.d#L415 I don't get this pattern. Is it documented somewhere ? http://dlang.org/variadic-function-templates.html

shared and idup

2014-08-19 Thread Low Functioning via Digitalmars-d-learn
shared int[] foo; auto bar() { foo ~= 42; return foo.idup; } Error: cannot implicitly convert element type shared(int) to immutable in foo.idup Is this not correct? If I instead dup'd an array of ints (or some other non-reference elements) and cast to immutable, would I be in

Phaser (single writer Disruptor) feedback

2014-08-09 Thread Low Functioning via Digitalmars-d-learn
https://bitbucket.org/nriddick/phaser So I made this thing for cross-thread data sharing/passing. It has the functionality I wanted out of it. Here's the gist of how I use it: auto phaser = new Phaser!(type,power2_number); foreach(i;0..threads) { spawn(pull_function,