Boost logo

Boost Users :

From: Ronald Garcia (garcia_at_[hidden])
Date: 2005-11-12 10:22:52


Hi Dennis,

I don't have access to VC++ 7.1 at the moment and cannot recreate the
error you are seeing on my platform. Could you try applying the
following patch to boost/multi_array/types.hpp and let me know if this
does the trick?

Thanks,
ron

*** types.hpp 01 Dec 2003 14:07:10 -0500 1.3
--- types.hpp 12 Nov 2005 10:19:48 -0500
***************
*** 26,32 ****

   // needed typedefs
   typedef std::size_t size_type;
! typedef int index;

   } // namespace multi_array
   } // namespace detail
--- 26,32 ----

   // needed typedefs
   typedef std::size_t size_type;
! typedef std::ptrdiff_t index;

   } // namespace multi_array
   } // namespace detail

On Nov 6, 2005, at 1:29 AM, Dennis Zickefoose wrote:

> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


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