Re: BinaryHeap usage

2010-12-14 Thread bearophile
Matthias Walter: > Any further ideas for this problem, or did I cover everything already? For a C programmer the solution with pointers seems more natural, for a Pascal-family programmer the solution with indexes seems more natural, a bit safer (and it is probably just as fast). A third possibl

Directory structure for D import files

2010-12-14 Thread Mandeep Singh Brar
I am trying to create import files using dmd -H option but the compiler creates all the import files in a single directory. It does not create a directory structure like it does for object files. Am i doing something wrong here. I can see that a possible way is to specify an output file for the imp

BinaryHeap usage

2010-12-14 Thread Matthias Walter
Hi all, suppose I have an array of comparable Foo structs which I want to access in a sorted order (e.g. a priority queue) using a BinaryHeap object (I know that for just sorting, the BinHeap is not the right tools), but I do not want to change the order of the objects in the original array. I ha

Re: overloading between templates and non-templates

2010-12-14 Thread Steven Schveighoffer
On Tue, 14 Dec 2010 13:17:11 -0500, #ponce wrote: In D2 : 1/ Is it valid to have two functions with the same name, one templated and another not ? I remember a NG thread but cannot find it. Yes, but it's not properly implemented. The ability is specified in TDPL. There is a bug somewh

Re: helpful runtime error messages

2010-12-14 Thread Jesse Phillips
spir Wrote: > Hello, > > > Am I the only one who gets, as only kind of runtime errors, spectacularly > helpful messages like: > > int f () {return 0;} > void main () { > assert (f() == 1); > } > ==> > s...@o:~/prog/d/Text$ ./__trials__ > core.exception.asserter...@__trials__(44): Assertion

overloading between templates and non-templates

2010-12-14 Thread #ponce
In D2 : 1/ Is it valid to have two functions with the same name, one templated and another not ? I remember a NG thread but cannot find it. void A(int x) { // blah } void A(T)(T x) { // blah } 2/ If (1)'s answer is yes, is it equivalent to a template specialization? void A(int x) { // blah }

Re: helpful runtime error messages

2010-12-14 Thread Jonathan M Davis
On Tuesday, December 14, 2010 09:48:14 spir wrote: > Hello, > > > Am I the only one who gets, as only kind of runtime errors, spectacularly > helpful messages like: > > int f () {return 0;} > void main () { > assert (f() == 1); > } > ==> > s...@o:~/prog/d/Text$ ./__trials__ > core.exception.

helpful runtime error messages

2010-12-14 Thread spir
Hello, Am I the only one who gets, as only kind of runtime errors, spectacularly helpful messages like: int f () {return 0;} void main () { assert (f() == 1); } ==> s...@o:~/prog/d/Text$ ./__trials__ core.exception.asserter...@__trials__(44): Assertion failure ./__trials__(

Re: random access-range without lower-power range kinds?

2010-12-14 Thread Jesse Phillips
Lars T. Kyllingstad Wrote: > To avoid the boilerplate, you could write a mixin that defines the > iteration primitives for you. > > mixin template IterationFuncs() > { > int index; > bool empty() { return index == length; } > auto front() { return opIndex(index); } >

Re: random access-range without lower-power range kinds?

2010-12-14 Thread spir
On Tue, 14 Dec 2010 14:15:20 + (UTC) "Lars T. Kyllingstad" wrote: > On Tue, 14 Dec 2010 09:09:33 +0100, spir wrote: > > > Hello, > > > > It seems impossible to define a random-access range (opIndex + length) > > alone. In fact, I cannot have it used by the language. Am I missing > > somethi

Re: random access-range without lower-power range kinds?

2010-12-14 Thread Lars T. Kyllingstad
On Tue, 14 Dec 2010 09:09:33 +0100, spir wrote: > Hello, > > It seems impossible to define a random-access range (opIndex + length) > alone. In fact, I cannot have it used by the language. Am I missing > something? Random-access looks enough to provide fonctionality for both > input and bidirecti

Re: Concurrency and transfering "ownership" of data between threads?

2010-12-14 Thread Pelle MÃ¥nsson
On 12/13/2010 09:45 PM, Heywood Floyd wrote: Good Evening from Berlin! Have been reading the chapter about concurrency by Andrei. Nice. I have some questions, of varying quality, I'm sure. Let's say that we have some sort of structure of rather complex data. To give us something concrete to

Re: random access-range without lower-power range kinds?

2010-12-14 Thread Jonathan M Davis
On Tuesday 14 December 2010 00:09:33 spir wrote: > Hello, > > It seems impossible to define a random-access range (opIndex + length) > alone. In fact, I cannot have it used by the language. Am I missing > something? Random-access looks enough to provide fonctionality for both > input and bidirecti

random access-range without lower-power range kinds?

2010-12-14 Thread spir
Hello, It seems impossible to define a random-access range (opIndex + length) alone. In fact, I cannot have it used by the language. Am I missing something? Random-access looks enough to provide fonctionality for both input and bidirectional ranges without any additional method. "Lowering" for f