Deque impl.

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Thu Jan 31 08:16:34 PST 2013


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


More information about the Digitalmars-d mailing list