Most elegant way for split array of struct into components

2016-07-04 Thread Miguel L via Digitalmars-d-learn
Hello I would like advice in the most elegant way for doing this in D: I have something like this: struct A { int x; int y; } A[] my_array; And I would need something like this: assert( my_array[0..n].x == [ my_array[0].x, my_array[1].x, ... my_array[n-1].x ]); assert( my_array[0..n].y == [

Re: Error: incompatible types for 'shared(SysTime)' and 'shared(SysTime)'

2016-07-04 Thread ketmar via Digitalmars-d-learn
On Monday, 4 July 2016 at 20:54:53 UTC, Luke Picardo wrote: if (curTime - lastMsgTime).total!"seconds") ... Both are shared Durations. also when I try to do lastMsgTime = curTime; Gives me Error: non-shared method std.datetime.SysTime.opAssign is not callable using a shared object. cast `

Re: Commit size and Page fault's very large for simple program

2016-07-04 Thread thedeemon via Digitalmars-d-learn
On Monday, 4 July 2016 at 11:56:14 UTC, Rene Zwanenburg wrote: On Monday, 4 July 2016 at 11:42:40 UTC, Rene Zwanenburg wrote: ... I forgot to mention: If you're on Windows compilation defaults to 32 bit, false pointers can be a problem with D's current GC in 32 bit applications. This isn't

Re: Probably trivial Linux link problem that I've spent hours on.

2016-07-04 Thread lobo via Digitalmars-d-learn
On Tuesday, 5 July 2016 at 03:32:25 UTC, WhatMeWorry wrote: Just learning Linux. Got my first vibe/dub project which dies at: [...] You need to install sqlite3, or download and build it yourself, to get libsqlite3.a. I don't use Ubuntu so not sure of the package but you will be able to "apt

Re: Probably trivial Linux link problem that I've spent hours on.

2016-07-04 Thread via Digitalmars-d-learn
On Tue, Jul 05, 2016 at 03:32:25AM +, WhatMeWorry via Digitalmars-d-learn wrote: > $ sudo apt-get install sqlite3 I'm just guessing, but try install sqlite3-devel too

Probably trivial Linux link problem that I've spent hours on.

2016-07-04 Thread WhatMeWorry via Digitalmars-d-learn
Just learning Linux. Got my first vibe/dub project which dies at: Compiling diet template 'index.dt'... Linking... /usr/bin/ld: cannot find -lsqlite3 collect2: error: ld returned 1 exit status I downloaded DUB's d2sqlite3 and built it fine. I've got sqlite3 on my system by default (came with Xu

Re: Initializing static array with contents of (static and dynamic) arrays

2016-07-04 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 4 July 2016 at 19:22:52 UTC, Johannes Loher wrote: This looks really nice, but I have several occurences of this, with different arrays (and lengths), so i would need to create several of those structs. But it looks really clean :) You can use a template to remove the boilerplate. H

Error: incompatible types for 'shared(SysTime)' and 'shared(SysTime)'

2016-07-04 Thread Luke Picardo via Digitalmars-d-learn
if (curTime - lastMsgTime).total!"seconds") ... Both are shared Durations. also when I try to do lastMsgTime = curTime; Gives me Error: non-shared method std.datetime.SysTime.opAssign is not callable using a shared object.

Re: Initializing static array with contents of (static and dynamic) arrays

2016-07-04 Thread Johannes Loher via Digitalmars-d-learn
Am 04.07.2016 um 19:24 schrieb ZombineDev: > On Monday, 4 July 2016 at 14:31:41 UTC, Johannes Loher wrote: >> In a project I am currently working on, I have lot's of code of the >> following form: >> >> static immutable ubyte[4] sigma0 = [101, 120, 112, 97]; static >> immutable ubyte[4] sigma1 = [

Re: Initializing static array with contents of (static and dynamic) arrays

2016-07-04 Thread Johannes Loher via Digitalmars-d-learn
Am 04.07.2016 um 20:33 schrieb Ali Çehreli: > On 07/04/2016 07:31 AM, Johannes Loher wrote: >> In a project I am currently working on, I have lot's of code of the >> following form: >> >> static immutable ubyte[4] sigma0 = [101, 120, 112, 97]; >> static immutable ubyte[4] sigma1 = [110, 100, 32,

Re: Initializing static array with contents of (static and dynamic) arrays

2016-07-04 Thread Ali Çehreli via Digitalmars-d-learn
On 07/04/2016 07:31 AM, Johannes Loher wrote: > In a project I am currently working on, I have lot's of code of the > following form: > > static immutable ubyte[4] sigma0 = [101, 120, 112, 97]; > static immutable ubyte[4] sigma1 = [110, 100, 32, 51]; > static immutable ubyte[4] sigma2 = [ 50,

Re: Initializing static array with contents of (static and dynamic) arrays

2016-07-04 Thread ZombineDev via Digitalmars-d-learn
On Monday, 4 July 2016 at 14:31:41 UTC, Johannes Loher wrote: In a project I am currently working on, I have lot's of code of the following form: static immutable ubyte[4] sigma0 = [101, 120, 112, 97]; static immutable ubyte[4] sigma1 = [110, 100, 32, 51]; static immutable ubyte[4] sigma2

Initializing static array with contents of (static and dynamic) arrays

2016-07-04 Thread Johannes Loher via Digitalmars-d-learn
In a project I am currently working on, I have lot's of code of the following form: static immutable ubyte[4] sigma0 = [101, 120, 112, 97]; static immutable ubyte[4] sigma1 = [110, 100, 32, 51]; static immutable ubyte[4] sigma2 = [ 50, 45, 98, 121]; static immutable ubyte[4] sigma3 = [116, 10

Re: Way to use var instead of auto?

2016-07-04 Thread ZombineDev via Digitalmars-d-learn
On Sunday, 3 July 2016 at 22:00:39 UTC, MMJones wrote: I like the term var better than auto. Is there a way to alias auto? If you really want to have Javascript-like semantics in D, you try this: https://github.com/adamdruppe/arsd/blob/master/jsvar.d

Re: Commit size and Page fault's very large for simple program

2016-07-04 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 4 July 2016 at 11:42:40 UTC, Rene Zwanenburg wrote: ... I forgot to mention: If you're on Windows compilation defaults to 32 bit, false pointers can be a problem with D's current GC in 32 bit applications. This isn't an issue for the sample application though, since you're not pu

Re: Commit size and Page fault's very large for simple program

2016-07-04 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 4 July 2016 at 01:57:19 UTC, Hiemlick Hiemlicker wrote: version(Windows) void main() { import std.random; while(getchar() != EOF) { auto x = new int[std.random.uniform(100, 1000)]; writeln(""); b