Boost logo

Ublas :

Subject: Re: [ublas] Why is there no constructor taking an initial value?
From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2009-01-24 06:15:25


Gunter Winkler skrev:
> Am Donnerstag, 22. Januar 2009 16:13 schrieb Thorsten Ottosen:
>> Hi,
>>
>> I was a bit surprised that there is no way to fill a
>> triangular_matrix with a default value. Say, I would have expected
>> this to work:
>>
>> triangular_matrix<double> m(42,42,42);
>>
>> Is there any reason why this constructor is not provided?
>
> because it is not needed:
>
> // untested
> triangular_matrix<double,lower> m((
> triangular_adaptor<lower>(scalar_matrix<double>(42,42,42))));

Right. I do something similar to get a zero matrix. But that syntax is
*so* verbose. Normal STL containers has this type of constructor, and so
users expect it to be provided.

-Thorsten