Boost logo

Ublas :

From: Vardan Akopian (vakopian_at_[hidden])
Date: 2006-02-15 23:01:59


Hi Erik,

On 2/15/06, Ramsay, Erik GOSS <Erik.Ramsay_at_[hidden]> wrote:
>
> Hi,
>
> I have the following test function:
>
>
>
> void Test()
>
> {
>
> boost::numeric::ublas::matrix<double> NewJ(32,32);
>
> boost::numeric::ublas::matrix<double>::iterator1
> itrNewJColumn = NewJ.begin1();
>
> itrNewJColumn[2];
>
> }
>
> I would like access different columns of "NewJ" through the use of column
> iterators. However, when I try to compile this code, I get a compile
> error:
>
> include\boost\numeric\ublas\iterator.hpp(1619) : error
> C2679: binary '+' : no operator found which takes a right-hand operand of
> type
> 'boost::numeric::ublas::indexed_iterator1<C,IC>::difference_type'
> (or there is no acceptable conversion)

It's strange that it's using the indexed_iterators as opposed to the
normal iterators. Do you have BOOST_UBLAS_USE_INDEXED_ITERATOR defined
explicitly somewhere (I think it's disabled by default).

The second thing, is that I think there is a bug in iterator.hpp,
where the indexed_iterators are dfined. indexed_iterators are derived
from random_access_iterator_base<IC, I, T, D>, where D is the
difference type. But for some reason indexed_iterators pass a
reference type as D. For example on lines 1553-1560 we have:
    template<class C, class IC>
    class indexed_iterator1:
        public container_reference<C>,
        public random_access_iterator_base<IC,
                                           indexed_iterator1<C, IC>,
                                           typename C::value_type,
                                           typename C::reference> {

so here D=C::reference, which in our case would be double& .
Would anyone more familiar with (indexed) iterators check this?

-Vardan

>
> What am I doing wrong or what am I missing.
>
> I'm compiling with the VC7 compiler. I'm using version 1.32 of Boost.
>
> Thanks for any help.
>
>
> _______________________________________________
> ublas mailing list
> ublas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/ublas
>
>
>