|
Boost : |
Subject: Re: [boost] Generic copy-on-write infrastructure in boost?
From: Edouard A. (edouard_at_[hidden])
Date: 2009-08-13 04:50:26
On Wed, 12 Aug 2009 18:09:39 -0700, Jason Dictos <jdictos_at_[hidden]>
wrote:
> I'm looking for a way to implement a project using some
> copy-on-write feature, similar to how STL strings use
> reference counters to prevent needles copying of data. Is
> there anything in boost to help me out with this?
If I understand correctly, what you need is something that passes the
pointer along of the object, and when a non const operation is performed on
the object, a "clone" like method is called?
I guess you could rework shared_ptr, and have a .get() const and a .get()
non const. When the refcount is 1, .get() does not clone.
Is that what you need?
ps : I'm curious, why do you need copy on write?
-- EA
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk