This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gsl_vector_alloc_from_vector


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]