I'm starting to think it would be both useful and feasible to have a general
reference counting template struct in Phobos:
struct RefCounted(T, alias onZero) {
// Implementation
}
Basically, you would provide it with a type T that it's supposed to count
references to and an
dsimcha:
> Reference counting is a pretty useful general technique for managing resources
> that can't have cycles and I think it makes sense to have a generic template
> for it instead of having people reimplement the same code over and over for
> file handles, large arrays of primitives that the
dsimcha wrote:
...
> Does this sound worthwhile?
Yes, we need this.
dsimcha wrote:
I'm starting to think it would be both useful and feasible to have a general
reference counting template struct in Phobos:
struct RefCounted(T, alias onZero) {
// Implementation
}
Basically, you would provide it with a type T that it's supposed to count
references
What are you planning to with multithreading?
With the current type system, is it possible to statically detect inside the
template if the refcount is used in shared scenario's, and base the
implementation on that information? That would be ideal, if it is indeed
possible.
std.stdio.File is r
On Mon, 14 Dec 2009 11:04:15 +0300, Lutger
wrote:
What are you planning to with multithreading?
With the current type system, is it possible to statically detect inside
the
template if the refcount is used in shared scenario's, and base the
implementation on that information? That would b
== Quote from Lutger (lutger.blijdest...@gmail.com)'s article
> What are you planning to with multithreading?
> With the current type system, is it possible to statically detect inside the
> template if the refcount is used in shared scenario's, and base the
> implementation on that information? Th
dsimcha Wrote:
> I'm starting to think it would be both useful and feasible to have a general
> reference counting template struct in Phobos:
> [...]
> Does this sound
> worthwhile?
Yes it does :-)
I believe this would be great for working with many C-based APIs. I recent
Denis Koroskin wrote:
> On Mon, 14 Dec 2009 11:04:15 +0300, Lutger
> wrote:
>
>> What are you planning to with multithreading?
>>
>> With the current type system, is it possible to statically detect inside
>> the
>> template if the refcount is used in shared scenario's, and base the
>> implement