Re: Where does "U" in Rebindable.Rebindable come from?

2012-03-29 Thread Tove
On Thursday, 29 March 2012 at 20:15:43 UTC, simendsjo wrote: If you look at the struct, it uses the type U in, among others, the union. The only place I could see U referenced is in the first static if, but I cannot recreate this behavior: void main() { static if(is(int X == const(U), U))

GC-less tutorial?

2012-04-07 Thread Tove
Hi, are there any good tutorials for using D totally without GC, detailing some common pitfalls? One thing on my wishlist would be a way to detect accidental GC allocations resulting from side-effects of every-day operations... generating linking errors would be sufficient for detecting thi

Re: GC-less tutorial?

2012-04-08 Thread Tove
On Saturday, 7 April 2012 at 17:31:02 UTC, Artur Skawina wrote: On 04/07/12 17:25, Tove wrote: Hi, are there any good tutorials for using D totally without GC, detailing some common pitfalls? One thing on my wishlist would be a way to detect accidental GC allocations resulting from side

reference counting resources but NOT memory

2021-01-16 Thread Tove via Digitalmars-d-learn
Is there any elegant/smart solution to reference counting resources without ever freeing any objects? When the ref hits 0 it should free some other resource that isn't memory... Resource[10] resources; resources[3].inc; // 1 ref - 0->1 transition enable some feature resources[3].dec; // 0 r

Re: How to specify an exact template?

2021-01-16 Thread Tove via Digitalmars-d-learn
On Saturday, 16 January 2021 at 14:14:57 UTC, solidstate1991 wrote: On Saturday, 16 January 2021 at 14:13:29 UTC, solidstate1991 wrote: Here's the following line, among many others: return &alphaBlend32bitMV!(ubyte); This generates an error, as this function template matches two instances, bu

Re: How to specify an exact template?

2021-01-16 Thread Tove via Digitalmars-d-learn
On Saturday, 16 January 2021 at 15:41:38 UTC, solidstate1991 wrote: On Saturday, 16 January 2021 at 14:18:55 UTC, Tove wrote: probably you can use https://dlang.org/spec/traits.html#getOverloads I don't know how to use it with functions outside of structs/classes. void foo() {} voi

Store multiple identical objects in a key:ed datastructure?

2019-11-01 Thread Tove via Digitalmars-d-learn
Consider a complex key that is a combination of multiple variables. struct key { intfoo = 1; string bar = "joy"; string baz = "huzza"; } The value is a very large object. struct value { int[4096] payload; } There are 10.000s of different keys. But typically only ~10 different valu