I had a bug in my code that was messing me up for a while, and it
boiled down to an identity check between two Object references
with unrelated static types, like below:
class A {}
class B {}
void main() {
A a = new A;
B b = new B;
if (a is b) {} // compiles
}
I was surprised that
On Friday, 1 September 2017 at 01:59:07 UTC, Brian wrote:
Hello, I am trying to get the most trivial example of
multithreading working, but can't seem to figure it out.
I want to split a task across threads, and wait for all those
tasks to finish before moving to the next line of code.
The fol
On Sunday, 9 April 2017 at 00:36:00 UTC, TheGag96 wrote:
I'm trying to use a binary heap initialized with one element.
However, this always seems to cause a range violation for some
reason. This small example will do it:
import std.stdio, std.container;
void main() {
auto pq = heapify([5]);
I can't figure out how to set the alignment of a struct using
align(n) on the outside of the struct. Only align on the fields
(default or annotated) seems to work. I get the same results back
to at least DMD 2.065... Is this a bug or am I using it wrong?
align(32) struct A { ubyte padding; }
p
On Saturday, 11 February 2017 at 15:02:11 UTC, error wrote:
On Saturday, 11 February 2017 at 14:43:18 UTC, rikki cattermole
wrote:
Try:
foreach(i, v; vars) {
vars[i] = ...;
}
Perfect! Thanks so much - I wish that hint was in the
documentation for variadic functions, although I guess
On Friday, 10 February 2017 at 23:57:18 UTC, bitwise wrote:
https://github.com/dlang/phobos/blob/cd7846eb96ea7d2fa65ccb04b4ca5d5b0d1d4a63/std/experimental/allocator/mallocator.d#L63-L65
Looking at Mallocator, the use of 'shared' doesn't seem correct
to me.
The logic stated in the comment abov
A quine I came up with a while ago, using q{} string notation:
enum s = q{enum s = q{%s};
void main() {
import std.stdio;
writefln(s,s);
}};
void main() {
import std.stdio;
writefln(s,s);
}
On Friday, 21 October 2016 at 01:51:44 UTC, Stefan Koch wrote:
On Friday, 21 October 2016 at 01:34:44 UTC, Nick Sabalausky
wrote:
When using reflection to obtain the fields of a class/struct,
is there any guarantee that the order is the same as the order
the fields are defined?
Yes they shoul
Is there a way to implement "getSymbolOfCall" and
"getDelegateOfCall" such that doit is functionally equivalent to
calling the method directly?
auto doit(C, string methodName, Args...)(C c, Args args) {
alias methodSymbol = getSymbolOfCall!(c, methodName, Args);
pragma(msg, hasUDA!(meth
On Monday, 8 August 2016 at 00:57:41 UTC, Michael Coulombe wrote:
...
And looking at the source, the reason it fails when using
TransverseOptions.assumeNotJagged is that it does not implement
length or $.
I made this into an enhancement request:
https://issues.dlang.org/show_bug.cgi?id=163
On Saturday, 6 August 2016 at 23:00:42 UTC, Alex wrote:
Hi all... a technical question from my side...
why the last line of the following gives the error?
import std.stdio;
import std.range;
import std.algorithm;
void main()
{
size_t[][] darr;
darr.length = 2;
darr[0] = [0, 1, 2, 3]
On Monday, 25 July 2016 at 22:57:05 UTC, Gorge Jingale wrote:
On Monday, 25 July 2016 at 22:27:11 UTC, Cauterite wrote:
On Monday, 25 July 2016 at 02:15:12 UTC, Gorge Jingale wrote:
Is there a static ternary if?
(A == B) ? C : D;
for compile type that works like static if.
You can pretty ea
On Friday, 15 July 2016 at 17:00:09 UTC, jmh530 wrote:
I was working with the lightweight wrapper and it seemed to
work for simple stuff, but then I started getting a bunch of
errors when I tried to integrate it in to my project.
Below is the stripped down version of what I've been working
wi
On Wednesday, 6 July 2016 at 19:50:11 UTC, pineapple wrote:
I'd like to do something like this but it doesn't seem to be
legal -
void test(int[] ints...) if(ints.length){
// stuff
}
Not being able to specify this interferes with how I'd like to
define my method overloads. What
On Friday, 29 April 2016 at 12:01:19 UTC, Joel wrote:
On Friday, 29 April 2016 at 11:31:51 UTC, rikki cattermole
wrote:
Not entirely the goal I'm guessing output wise, but this works.
import std.range : repeat;
foreach(line; 1 .. 11) {
writeln('#'.repeat(line));
}
That is shorter than
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 w
On Saturday, 30 May 2015 at 15:06:16 UTC, short2cave wrote:
Yes, kind of. The template should be able to generate the
accessors using the fields of the struct passed as template
argument. But also a special accessor wich returns all the
items accessors, in a structured way:
---
struct Model
17 matches
Mail list logo