Brian Gough
Tue Feb 10 11:48:00 GMT 2004

Sebastian Tannert writes:
 > Hm, but as far as I've seen the vector view concept
 > just covers the same stuff inside a new struct.
 > Is there any advantage beside having two distinct data types?
 > In a first look it only seems to make using vector views
 > more complicated and to take more time for another 
 > step in accessing the data from memory.

The advantage of views is that they make clear which objects own the
underlying memory of the vector data and are responsible for
deallocating it.  Vectors always have ownership of the data, views
never do.

In the previous method, where there was only the vector type, it was
not possible to distinguish between the two cases so easily (that was
a long time ago though).

I don't think views any significant performance disadvantage.  Since
they are allocated on the stack they can be more efficient than some
of the old vector-style usage of malloc that was originally needed.

Brian Gough

More information about the Gsl-discuss mailing list