On 01/31/2013 05:16 PM, Andrei Alexandrescu wrote:
On 1/31/13 11:12 AM, Robert burner Schadek wrote:
struct Deque(T) {
struct Payload {
T* array;
size_t head, size;
size_t ref;
}

Payload* load;

~this() {
if(load !is null && (load.ref-=1) == 0) {
free(load);
}
}

Yes, that's the general pattern. I agree it's a pain but I also understand that library containers are not required to look like casual application code.

Andrei
Sure, adding this will not make it looker prettier, but it is not that bad either. Just one more indirection.

Reply via email to