Copy-On-Write (COW) Managed Containers?
ikod
igor.khasilev at gmail.com
Tue Oct 20 15:40:31 UTC 2020
On Tuesday, 20 October 2020 at 12:42:26 UTC, Per Nordlöw wrote:
> What are your thoughts on the pros and cons with copy-on-write
> (COW) managed allocations in D, typically for containers such
> as `std.container.Array`?
I use COW to create copy for hashmap bucket array if user decided
to mutate container during byKey/byPair iteration. The only
downside I see is temporary doubled memory usage. The benefits
are clear - you can provide stable iterators.
More information about the Digitalmars-d
mailing list