On Tuesday, 11 December 2012 at 13:22:42 UTC, monarch_dodra wrote:
Anyways, opAssign is *definitely* necessary. Without it,
assignment would be equivalent to aliasing, and you wouldn't
have actual COW (both instances would end up modified). What's
more, if the current object had a handle on another payload,
you wouldn't release it, causing it to duplicate for no reason
(but that's moot considering COW is already broken). In my
example, it works because no-one actually *calls* opAssign.
Can you confirm this with an example? Again, I think default
opAssign calls postblit. postblit increments. In this example
everything looks fine without opAssign (except for the bug you
point out regarding S()).
http://dpaste.dzfl.pl/7fe03a43
What you have to keep in mind is that a "triple COW" design
would only make sense if you have functions that modify one of
your 3 maps. If they are always modified together, it'd make no
sense to use "triple COW".
I see.
//----
When everything is said and done, most of that code can be
templated, or mixed-in.
If so, sounds like useful additions to phobos.
Thanks
Dan