Blitz logo

Blitz Support :

From: Manuel Gamito (mgmt69_at_[hidden])
Date: 2003-12-30 03:30:54


Hello,

Here is a little piece of code that compiles fine with
Blitz 0.6 but fails with Blitz 0.7. The compiler is gcc
3.3.2

        typedef blitz::Array<int,2> IntArray;

        IntArray ia;
        IntArray::iterator it(ia);

        it = ia.begin();

The output of the compiler is:

/usr/local/blitz/include/blitz/array/iter.h: In member
function `void blitz::ConstPointerStack<P_numtype,
N_rank>::operator=(const
blitz::ConstPointerStack<P_numtype, N_rank>&) [with
P_numtype = int, int N_rank = 2]':
teste.cc:12: instantiated from here
/usr/local/blitz/include/blitz/array/iter.h:40: error: ISO
C++ forbids assignment of arrays

I went to check the Blitz code in blitz/array/iter.h and,
indeed, ArrayIterator is derived from ConstArrayIterator,
which, in turn, contains two ConstPointerStack objects. The
ConstPointerStack class contains an array stack_[N_rank] as
a private member.

ConstPointerStack defines an assignment operator which
tries to copy between two arrays with the statement "stack_
= rhs.stack_" (iter.h, line 36). I wonder if the intention
is just to copy the pointer to the start of the array.

Does this mean that, in 0.7, it is no longer possible to
use iterator assignment?

manuel gamito