Boost.MultiArray + iterators
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
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
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
::difference_type' to 'boost::detail::multi_array:: array_iterator ::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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
That worked great. Thanks a million. DZJr Ronald Garcia wrote:
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
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
::difference_type' to 'boost::detail::multi_array:: array_iterator ::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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Hi Dennis, Glad to hear that the patch worked. I have applied it to the Boost CVS repository as well. Thanks for the verification. Cheers, ron On Nov 12, 2005, at 11:12 PM, Dennis Zickefoose wrote:
That worked great. Thanks a million.
DZJr
Ronald Garcia wrote:
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
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
::difference_type' to 'boost::detail::multi_array:: array_iterator ::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@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Dennis Zickefoose
-
Ronald Garcia