|
Ublas : |
From: Sebastian Gesemann (s.gesemann_at_[hidden])
Date: 2007-12-10 10:00:56
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