Boost logo

Ublas :

From: Michael Stevens (mail_at_[hidden])
Date: 2006-11-16 16:43:20


Jeff,

On Thursday, 16. November 2006 19:18, Yoder, Jeffrey - SSD wrote:
> Why don't boost vectors offer a push or push_back type method? It seems
> odd to require external maintenance of the current vector size, or the
> use of a separate call to a size method, or creation of an iterator just
> to add a value to the end of the vector.

The informal reason is that dense uBLAS vectors are not STL vectors, they just
happen to have the same name!

An STL vector provide indexible storage with an efficient growth stratergy for
appended element. The later requires the notion of capacity and storage
doubling when the current capacity is exceeded.

A uBLAS vector provide indexible storage with an algebraic size (the size in a
linear algebra expression) that is identical to storage capacity required.

Without adding the notion of capacity you cannot implement the push functions
with the same semantics as STL does. If we wanted such a function for ease of
use it would be better to call it something else to avoid confusion!

-- 
___________________________________
Michael Stevens Systems Engineering
34128 Kassel, Germany
Phone/Fax: +49 561 5218038
Navigation Systems, Estimation  and
                 Bayesian Filtering
    http://bayesclasses.sf.net
___________________________________