Boost logo

Ublas :

From: Neal Becker (ndbecker2_at_[hidden])
Date: 2007-12-10 10:07:30


Sebastian Gesemann wrote:

> On Dec 10, 2007 3:52 PM, Neal Becker <ndbecker2_at_[hidden]> wrote:
>
>> Either I completely misunderstand something, or zero_vector is seriously
>> broken:
>>
>> int main() {
>> ublas::zero_vector<double> zeros (10);
>> copy (zeros.begin(), zeros.end(), ostream_iterator<double> (cout, " "));
>> }
>>
>> I expect this to print 10 '0'. Instead, it prints nothing.
>>
>
> That's probably because begin() and end() return an *indexed iterator*
> which might skip zeros.
>
> A normal ("dense") vector behaves the way you want it to -- but in general
> I wouldn't count in it. You better check the indexed iterator concept
> again.
>
> Cheers!
> SG

So, we actually _want_ iterators of a zero vector to skip over the zeros? I
guess I really don't understand this.