Blitz logo

Blitz Support :

From: Fernando Perez (fperez_at_[hidden])
Date: 2003-10-07 18:30:29


Hi all,

Note: I'm using a CVS of blitz from a few weeks ago. I tried updating my CVS
today, but SF seems to be unreachable, so my apologies in advance if this has
been recently fixed and I missed it.

The manual says for TinyVector:

quote:

TinyVector<T,N>::iterator end();
TinyVector<T,N>::const_iterator end() const;

Returns an STL-style iterator for the vector, positioned at the end of the data.

/quote

However, the following program (basically a TinyVector version of the iter.cpp
example supplied with blitz):

#include <blitz/array.h>

using namespace blitz;

int main()
{
     TinyVector<int,5> A;
     A = 1,3,5,7,9;

     cout << "A = " << A << endl;

     // Use an iterator to list the array elements
     TinyVector<int,5>::iterator iter = A.begin(), end = A.end();

     while (iter != end) {
         cout << iter.position() << '\t' << (*iter) << endl;
         ++iter;
     }
}

fails to compile with:

planck[blitz]> g++ iter.cpp
iter.cpp: In function `int main()':
iter.cpp:13: no matching function for call to `blitz::TinyVector<int, 5>::end()

Is this an error in my usage, in the manual, or in the library? I tried
compiling the supplied example which uses Array<> with iterators, and that one
works fine. All I did was change the type of array to TinyVector.

Thanks in advance for any help.

Regards,

Fernando.