Re: question on [Issue 7853]

2012-11-05 Thread Tobias Pankrath
On 11/05/2012 02:24 AM, Dan wrote: Thanks. The reason I'm down this path is something like below. I really want to keep const ref for parms on a method (e.g. foo below). It turns out the type is a assoc array and length and keys are both giving me a headache. Without the cast I get a message

Re: question on [Issue 7853]

2012-11-05 Thread Dan
On Monday, 5 November 2012 at 09:10:41 UTC, Tobias Pankrath wrote: Casting away const is okay as long as you don't change a single bit of your data. Yes, thanks. Makes sense. I need to know not only what I might be mutating, but also code I call. In this specific case, though I hope all

Re: question on [Issue 7853]

2012-11-05 Thread Tobias Pankrath
On 11/05/2012 12:43 PM, Dan wrote: On Monday, 5 November 2012 at 09:10:41 UTC, Tobias Pankrath wrote: I have not figured what to look at for associative arrays. For example, in .../druntime/import/object.di there is a struct called AssociativeArray which I imagine the [ foo : goo ] syntactic

Tuples and variable-length template parameter lists

2012-11-05 Thread Joseph Rushton Wakeling
Hello all, Suppose I want to define a tuple type which may have a variable length, e.g.: template Tup(ID, Properties...) { static if(Properties.length == 0) alias Tuple!(ID, id) Tup; else alias

removing element from DList

2012-11-05 Thread Jack Applegame
How to get range for single just inserted element? DList!int list; ... list.insertBack(5); auto r = ??? // get range for single last element ... list.insertBack(something); ... list.remove(r);

Re: Tuples and variable-length template parameter lists

2012-11-05 Thread Simen Kjaeraas
On 2012-11-05, 15:53, Joseph Rushton Wakeling wrote: Hello all, Suppose I want to define a tuple type which may have a variable length, e.g.: template Tup(ID, Properties...) { static if(Properties.length == 0) alias Tuple!(ID, id)

some mixin utilities

2012-11-05 Thread Dan
I've created some mixins that I think will help me with structs, and being new to D would like some constructive criticism/suggestions on the code. The code is at https://github.com/patefacio/d-help/blob/master/d-help/opmix/mix.d Some questions: - I have done a bit of casting in a few places

Re: removing element from DList

2012-11-05 Thread cal
On Monday, 5 November 2012 at 16:41:16 UTC, Jack Applegame wrote: How to get range for single just inserted element? DList!int list; ... list.insertBack(5); auto r = ??? // get range for single last element ... list.insertBack(something); ... list.remove(r);

Re: removing element from DList

2012-11-05 Thread Jack Applegame
On Monday, 5 November 2012 at 18:52:24 UTC, cal wrote: http://forum.dlang.org/thread/cfkllwgfushidyuwz...@forum.dlang.org I read it. It's absolutely useless for my question.

Re: removing element from DList

2012-11-05 Thread Jonathan M Davis
On Monday, November 05, 2012 17:41:15 Jack Applegame wrote: How to get range for single just inserted element? DList!int list; ... list.insertBack(5); auto r = ??? // get range for single last element ... list.insertBack(something); ... list.remove(r); If you want to remove an element,

Re: removing element from DList

2012-11-05 Thread Jonathan M Davis
On Monday, November 05, 2012 19:35:57 Jack Applegame wrote: On Monday, 5 November 2012 at 18:06:44 UTC, Michael wrote: Something like auto r = list[$ - 1]; Error: no [] operator overload for type DList!(int) The range returned by list isn't random access, and it can't be random access,

Re: some mixin utilities

2012-11-05 Thread Dan
On Monday, 5 November 2012 at 18:53:20 UTC, Tobias Pankrath wrote: I like the general style. However this provokes a invinite loop: Good catch. Fixed. There may be more complex scenarios of nested locking references that cause similar loop. And I would find the comparison more useful,

Re: Memory overhead for a fiber?

2012-11-05 Thread Piotr Szturmaj
W dniu 06.11.2012 04:43, Nick Sabalausky pisze: What kind of memory overhead is there for a fiber? At least one PAGESIZE (typically 4KB): https://github.com/D-Programming-Language/druntime/blob/master/src/core/thread.d#L3828