Error (runtime) assigning multi_array to multi_array with smaller dimensions
Hello everyone, I'm getting an error when trying to get one sub array from a multi_array with 2 dimensions. This is the code: //at class constructor boost::multi_array<char, 2> array2d = new boost::multi_array<char, 2>(boost::extents[x][y]); ... //at class method boost::multi_array<char, 1> array1d = array2d[0]; And the error i got: Reference boost::detail::multi_array::value_accessor_n<T, NumDims>::access(boost::type<Reference>, boost::multi_array_types::index, TPtr, const boost::multi_array_types::size_type*, const boost::multi_array_types::index*, const boost::multi_array_types::index*) const [with Reference = boost::detail::multi_array::sub_array<char, 1u>, TPtr = char*, T = char, unsigned int NumDims = 2u]: Assertion `size_type(idx - index_bases[0]) < extents[0]' failed. Could anyone help, please? Thanx, -- Matheus Araújo Aguiar Computer Scientist matheus.pit@gmail.com
AMDG Matheus Araújo Aguiar wrote:
Hello everyone,
I'm getting an error when trying to get one sub array from a multi_array with 2 dimensions. This is the code:
//at class constructor boost::multi_array<char, 2> array2d = new boost::multi_array<char, 2>(boost::extents[x][y]);
Is that exactly what you did? If so I'm surprised that it compiles, because you are trying to assign a pointer to a multi_array to a multi_array. In Christ, Steven Watanabe
Sorry, there's no 'new' word there ... On Wed, May 20, 2009 at 3:44 PM, Steven Watanabe <watanabesj@gmail.com>wrote:
AMDG
Matheus Araújo Aguiar wrote:
Hello everyone,
I'm getting an error when trying to get one sub array from a multi_array with 2 dimensions. This is the code:
//at class constructor boost::multi_array<char, 2> array2d = new boost::multi_array<char, 2>(boost::extents[x][y]);
Is that exactly what you did? If so I'm surprised that it compiles, because you are trying to assign a pointer to a multi_array to a multi_array.
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Matheus Araújo Aguiar Computer Scientist matheus.pit@gmail.com
participants (2)
-
Matheus Araújo Aguiar
-
Steven Watanabe