digitalmars.D - Using std.container with std.allocator
- Etienne (16/16) Dec 21 2013 I'm trying to implement a caching container that cleans up after its
I'm trying to implement a caching container that cleans up after its items based on expiration of nodes. I'd like to use the new std.allocator to make sure it's restricted to a region in memory. The documentation of std.container states that Array uses malloc/free, but does it fallback on the (SharedFreelist) std.allocator if it's used like this: struct Item { uint hashid; uint hashkey; U value; time_t added; } SharedFreelist!(BinaryHeap!(Array!(Item), "a.added < b.added")) m_store; I need the ability sort by "Item.added" which is why I use BinaryHeap!Array. How would one go about doing this if it's not possible through Array?
Dec 21 2013