Re: Regarding partition_copy

2013-05-05 Thread Andrei Alexandrescu
On 5/5/13 7:22 AM, bearophile wrote: Splitting a range in two according to a predicate is a common enough need. How do you translate this C++/STL idiom to D/Phobos? vector source_data; ... vector good_stuff, bad_stuff; partition_copy(begin(source_data), end(source_data), inserter(good_stuff, en

Re: Avoid initializing a struct field.

2013-05-05 Thread Marco Leise
Am Sat, 04 May 2013 21:00:17 +0200 schrieb "jerro" : > I tried using float[42] instead of int[42] and found out that > buffer actually isn't initialized to its default initializer if I > use "= void" (the numbers were all 0 instead of NaN), but the > performance cost is still there. Zero is th

Re: D is totally useless

2013-05-05 Thread David
Am 01.05.2013 21:36, schrieb Dejan Lekic: > Temtaime wrote: > >> I had investigate a little more in it. >> Thanks to Jack Applegame, we made a copy of gl/gl.h and >> opengl32.lib for DMD. >> >> http://acomirei.ru/u/gl.d >> http://acomirei.ru/u/opengl32.lib >> >> I hope it will be included in DMD,

Re: D is totally useless

2013-05-05 Thread Raphaël Jakse
Le 02/05/2013 04:07, Carlos a écrit : On Wednesday, 1 May 2013 at 08:53:18 UTC, Raphaël Jakse wrote: Le 01/05/2013 10:42, Temtaime a écrit : I'm new in D, so i'm tried to write some in that langugage. That's story about how i tried to port OGL sample, that renders one triangle. You can do mu

Regarding partition_copy

2013-05-05 Thread bearophile
Splitting a range in two according to a predicate is a common enough need. How do you translate this C++/STL idiom to D/Phobos? vector source_data; ... vector good_stuff, bad_stuff; partition_copy(begin(source_data), end(source_data), inserter(good_stuff, end(good_stuff)),

About std.string.representation

2013-05-05 Thread bearophile
Is it possible to have a transparent (by reference) std.string.representation? It's handy to modify the chars, like with permutations: import std.stdio: writeln; import std.range: nextPermutation; import std.string: representation; void main() { char[] perm = "abcd".dup; do { w

Re: Check if tuple contains value at compile time

2013-05-05 Thread bearophile
Diggory: Is the behaviour of the empty [] when applied to tuples documented anywhere? I don't remember. The problem is that this doesn't work if the tuple is empty: Error: template std.algorithm.canFind does not match any function template declaration. And unfortunately in the situation

Re: C Memory

2013-05-05 Thread Namespace
Here a test example: http://dpaste.1azy.net/2cfc8ead The memory is allocated through the SDL as you can see.

Re: C Memory

2013-05-05 Thread Johannes Pfau
Am Sun, 05 May 2013 09:28:05 +0200 schrieb "Diggory" : > On Sunday, 5 May 2013 at 07:23:25 UTC, Namespace wrote: > > On Sunday, 5 May 2013 at 06:43:17 UTC, Diggory wrote: > >> On Sunday, 5 May 2013 at 06:35:38 UTC, Namespace wrote: > >>> Quick question: I have a SDL_Surface in one of my classes an

Re: C Memory

2013-05-05 Thread Diggory
On Sunday, 5 May 2013 at 07:23:25 UTC, Namespace wrote: On Sunday, 5 May 2013 at 06:43:17 UTC, Diggory wrote: On Sunday, 5 May 2013 at 06:35:38 UTC, Namespace wrote: Quick question: I have a SDL_Surface in one of my classes and the SDL_Surface contains (obviously) memory to the pixel data. Sin

Re: C Memory

2013-05-05 Thread Namespace
On Sunday, 5 May 2013 at 06:43:17 UTC, Diggory wrote: On Sunday, 5 May 2013 at 06:35:38 UTC, Namespace wrote: Quick question: I have a SDL_Surface in one of my classes and the SDL_Surface contains (obviously) memory to the pixel data. Since I cannot free this memory with the DTor: what will ha