DMD Stdio Linker Oddities

2016-12-24 Thread Jake Pittis via Digitalmars-d-learn
I'm posting this in Learn because I'm assuming I've done something wrong rather than discovered a bug. Running `dmd -main main.d` with the following 3 files produces the following linker error. ``` $ dmd -main main.d Undefined symbols for architecture x86_64:

Re: How to serialize a double.

2016-12-01 Thread Jake Pittis via Digitalmars-d-learn
On Thursday, 1 December 2016 at 07:13:45 UTC, Bauss wrote: On Thursday, 1 December 2016 at 00:36:30 UTC, Jake Pittis wrote: [...] You could do something like below which will allow you to serialize any number. import std.stdio : writeln; import std.traits : isNumeric; ubyte[]

How to serialize a double.

2016-11-30 Thread Jake Pittis via Digitalmars-d-learn
How do I convert a double to a ubyte[]? I've tried all sorts of things including converting the double to a ulong and trying to serialize the ulong. For example test bellow fails. unittest { double d = 3.14; ulong l = *cast(ulong*)(); double after = *cast(double*)());

Unable to convert a MapResult to an InputRange.

2016-09-18 Thread Jake Pittis via Digitalmars-d-learn
import std.stdio; import std.array; import std.algorithm; import std.range; InputRange!string keys(int[string] foo) { return foo.byPair.map!(p => p[0]); } void main() { int[string] foo; foo["lol"] = 1; foo["wat?"] = 2; keys(foo).each!(p => writeln(p)); } The above code