Re: Simplified socket creation and handling

2012-05-21 Thread Nathan M. Swan
On Monday, 21 May 2012 at 17:54:56 UTC, Adam D. Ruppe wrote: On Saturday, 19 May 2012 at 20:33:49 UTC, Nathan M. Swan wrote: It has some pitfalls (e.g. I can't find a good way to stop the server) When I use it, I just leave it open in a terminal window. Control+C can then kill it. (I'm on linu

Re: moveAt vs opIndex

2012-05-21 Thread maarten van damme
well, they we're interfaces and it made sense to implement them as a class. On the other hand, a struct is way more efficient and works just as good. Thanks for clearing everything up.

Re: Simplified socket creation and handling

2012-05-21 Thread Adam D. Ruppe
On Saturday, 19 May 2012 at 20:33:49 UTC, Nathan M. Swan wrote: It has some pitfalls (e.g. I can't find a good way to stop the server) When I use it, I just leave it open in a terminal window. Control+C can then kill it. (I'm on linux but I think the same would apply on Windows.) That's the on

Re: "repeating pair" regex

2012-05-21 Thread Thor
On Monday, 21 May 2012 at 13:06:45 UTC, Dmitry Olshansky wrote: On 21.05.2012 17:05, Dmitry Olshansky wrote: On 21.05.2012 16:42, Thor wrote: Hi, I tried something like this... auto m = match("a=42 b=32 c=22", regex(`^(?: \s* (\w+)=(\d+) )+$`, `x`)); This works fine... `^(?: \s* (\w+)=(\d+)

Re: std.range.put?

2012-05-21 Thread jerro
void put(int v){ arr ~= v; } should be void put(T v){ *arr ~= v; }

Re: std.range.put?

2012-05-21 Thread jerro
On Monday, 21 May 2012 at 11:26:33 UTC, simendsjo wrote: Shouldn't the following work? import std.range; import std.stdio; void main() { int[] a; a.reserve(10); //a.put(1); // Attempting to fetch the front of an empty array of int a.length = 1; writeln(a.length); // 1

Re: "repeating pair" regex

2012-05-21 Thread Dmitry Olshansky
On 21.05.2012 17:05, Dmitry Olshansky wrote: On 21.05.2012 16:42, Thor wrote: Hi, I tried something like this... auto m = match("a=42 b=32 c=22", regex(`^(?: \s* (\w+)=(\d+) )+$`, `x`)); This works fine... `^(?: \s* (\w+)=(\d+) )+$` ... and if I duplicate the string x times, it also works...

Re: "repeating pair" regex

2012-05-21 Thread Dmitry Olshansky
On 21.05.2012 16:42, Thor wrote: Hi, I tried something like this... auto m = match("a=42 b=32 c=22", regex(`^(?: \s* (\w+)=(\d+) )+$`, `x`)); This works fine... `^(?: \s* (\w+)=(\d+) )+$` ... and if I duplicate the string x times, it also works... But I'm hoping to parse a variable number of t

"repeating pair" regex

2012-05-21 Thread Thor
Hi, I tried something like this... auto m = match("a=42 b=32 c=22", regex(`^(?: \s* (\w+)=(\d+) )+$`, `x`)); This works fine... `^(?: \s* (\w+)=(\d+) )+$` ... and if I duplicate the string x times, it also works... But I'm hoping to parse a variable number of these 'pairs'... so I tried grou

std.range.put?

2012-05-21 Thread simendsjo
Shouldn't the following work? import std.range; import std.stdio; void main() { int[] a; a.reserve(10); //a.put(1); // Attempting to fetch the front of an empty array of int a.length = 1; writeln(a.length); // 1 a.put(2); writeln(a.length); // 0 - what? writeln(a)

Re: convert ubyte[k..k + 1] to int

2012-05-21 Thread Luis Panadero GuardeƱo
ref2401 wrote: > i have an array of ubytes. how can i convert two adjacent ubytes > from the array to an integer? > > pseudocode example: > ubyte[5] array = createArray(); > int value = array[2..3]; > > is there any 'memcpy' method or something else to do this? Try to use littleEndianToNative o

Re: moveAt vs opIndex

2012-05-21 Thread Jonathan M Davis
On Saturday, May 19, 2012 17:28:46 maarten van damme wrote: > and something partially unrelated, how do you copy a class by value? You don't. If the class has a clone method (which would fairly typically be called dup in D), then you can clone it, but classes are reference types, not value types