Boost logo

Glas :

Re: [glas] Reference counting?

From: Karl Meerbergen (Karl.Meerbergen_at_[hidden])
Date: 2007-10-12 10:36:53


Russell Smiley wrote:

>>-----Original Message-----
>>From: Karl Meerbergen
>>Subject: Re: [glas] Reference counting?
>>
>>* if v and w are two vectors (or vector views), what does the
>>operation
>>w = v do ?
>>
>>
>>
>
>In my implementation of a reference counted object w=v means that w
>drops the reference to its current storage (with a resulting decrement
>to the reference count for that object) and then picks up the reference
>to the storage in v with a resulting increment to that reference count.
>I think this is the most useful for general application.
>
>If you want to copy values from the v storage into the w storage then
>there are two separate methods:
>
>w.value_copy(v) - copies values from v, but w dereferences current
>storage and creates a new 'blank' storage before the copy.
>
>w.value_copy_this_reference(v) - copies values from v into the current
>storage of w.
>
>
>

Hi Russell,

In previous discussions, it was suggested that w = v performs a deep copy.

 From a mathematics point of view, this is also what you expect.

Karl