Boost logo

Boost Users :

From: Dennis Zickefoose (dennis.zickefoose_at_[hidden])
Date: 2005-11-06 01:29:33


I have a simple two dimensional multi_array that I am trying to copy a
row out of. This works, but I get a warning about a type conversion
that I would like to get rid of. Example:

boost::multi_array<double, 2> array(boost::extents[42][42]);
std::vector<double> row(array[0].begin(), array[0].end());

This produces the following warning in VC++ 7.1:
c:\Boost\include\boost-1_33\boost\multi_array\iterator.hpp(149) :
warning C4244: '+=' : conversion from
'boost::detail::multi_array::array_iterator<T,TPtr,NumDims,Reference>::difference_type'
to
'boost::detail::multi_array::array_iterator<T,TPtr,NumDims,Reference>::index',
possible loss of data

This is followed by a long string of support messages that ultimately
point to the vector initialization. Yet the vector is successfully
initialized with the range of values I expect. So what am I doing wrong
here? I understand that [array.begin(), array.end()) is actually a
range of sub-views, rather than a range of values...is this a side
effect of this distinction?

At the moment, I have replaced that with &array[0][0] to avoid the
warning, but if possible I would like to go with the more reliable
iterator interface in the future.

Any suggestions/advice would be greatly appreciated.

DZJr


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net