Boost logo

Glas :

Re: [glas] Reference counting?

From: Russell Smiley (smiley_at_[hidden])
Date: 2007-10-12 10:27:13

> -----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.