Re: making COW and ownership

2012-11-21 Thread Dan
On Wednesday, 21 November 2012 at 04:23:56 UTC, Era Scarecrow wrote: Here's a quick thrown together example of what I'm talking about. I think I see where you are going. After the copy creation of new_ca you have two objects referencing exactly the same data. It doesn't show it, but the

Re: making COW and ownership

2012-11-21 Thread Era Scarecrow
On Wednesday, 21 November 2012 at 10:15:52 UTC, Timon Gehr wrote: This also duplicates the data if you move the struct in memory and then mutate. Probably you just need to have a boolean owner flag and set it to false on postblit. Hadn't thought of a move being involved.. I was trying to use

making COW and ownership

2012-11-20 Thread Era Scarecrow
I was thinking briefly and glancing over documentation regarding cluts and non-cluts (Reference vs value types), and considering my BitArray implementation. I was having a problem trying to solve how to avoid duplicating it unless it actually was needed; And I've come to a possible solution.