Re: [glas] Reference counting?
From: Karl Meerbergen (Karl.Meerbergen_at_[hidden])
Date: 2007-10-12 10:22:56
Neal Becker wrote:
>On Friday 12 October 2007, Bert Rodiers wrote:
>>In RogueWave they do the following:
>>A vector has a view, which on its turn points to the actual data (a C++
>>data structure aggregating the data).
>>When you for example apply a slice on your vector you get a new vector with
>>a different view on the same data (the sharing of the data happens with
>>reference counting, and the view keeps track of the new start, length and
>>stride). The data is cleaned up at the moment no views exist anymore. For
>>matrices and higher dimension structures they also apply this so that when
>>you extract a column from a matrix the data is shared between the original
>>matrix and the vector which was the result of the slice.
>In blitz++ this is also applied to 'components' of an array. For example,
>complex has real and imag components. Thus, real(array) is an lvalue! Very
In GLAS, real(array) is also an lvalue ;-) At the moment, it is only
const, but this is not hard to change.