Boost logo

Ublas :

From: Marc Duflot (marc.duflot_at_[hidden])
Date: 2005-07-01 02:30:37


Michael Stevens wrote:
> On Thursday 23 June 2005 17:04, Marc Duflot wrote:
>
>
>>I see that there is some discussion about the initialization to zero of
>>vector elements and I understand that the default behaviour is to left
>>them uninitialized (even if the documentation claims that 'Elements are
>>zeroed by default' in the overview).
>>
>>Is there a way to change this behaviour with a macro, a template
>>parameter or something else?
>
> Two possibilities
> my_vector_type<double> my_vector ( zero_vector<double>(1) );
>
> OR
> my_vector_type my_vector(1); my_vector.clear ();
>
> The latter is more efficient.

Why was the name clear() chosen for this function? One would expect
clear() to erase all the elements (like std::vector) not to initialize them.