[multi_array] view-multi_array compatibility in assignments and parameter passing

I have a 4D multi_array and I define a 3D view on it. I can assign the view to a 3D multi array but I can't pass it directly to a constructor that takes a 3D multi_array. Isn't a 3d view on anything a model of a 3d multi_array? (for the sake of this discussion, element is always double). Code: #include <boost/multi_array.hpp> using namespace boost; class moviva { public: moviva(multi_array<double, 3> m) {} }; main(){ typedef multi_array<double, 4> array_type; typedef array_type::index_range range; multi_array<double, 4> ta4; multi_array<double, 3> ta3; ta3 = ta4[indices[range()][range()][range()][1]]; moviva ma(ta3); // compiles moviva ma1 (ta4[indices[range()][range()][range()][1]]); //does not, line 20 } Compilation view_test.cpp: In function `int main()': view_test.cpp:20: error: no matching function for call to `moviva::moviva( boost::detail::multi_array::multi_array_view<double, 3>)' view_test.cpp:5: error: candidates are: moviva::moviva(const moviva&) view_test.cpp:7: error: moviva::moviva(boost::multi_array<double, 3, std::allocator<double> >) Thanks Antonio

Greetings Antonio, What compiler are you using? I copied your code verbatim and it compiles and runs fine on my machine (I used gcc version 3.3 ron On Jan 14, 2006, at 9:44 PM, Antonio Piccolboni wrote:
I have a 4D multi_array and I define a 3D view on it. I can assign the view to a 3D multi array but I can't pass it directly to a constructor that takes a 3D multi_array. Isn't a 3d view on anything a model of a 3d multi_array? (for the sake of this discussion, element is always double).
Code: ...

Thanks for your message Ronald, the short answer is 3.3.3 the long one is specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --disable-libunwind-exceptions --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7) Maybe the boost version (boost-1.31.0-7) counts as well. This is puzzling, any suggestion is welcome Antonio On 1/18/06, Ronald Garcia <garcia@cs.indiana.edu> wrote:
Greetings Antonio,
What compiler are you using? I copied your code verbatim and it compiles and runs fine on my machine (I used gcc version 3.3
ron
On Jan 14, 2006, at 9:44 PM, Antonio Piccolboni wrote:
I have a 4D multi_array and I define a 3D view on it. I can assign the view to a 3D multi array but I can't pass it directly to a constructor that takes a 3D multi_array. Isn't a 3d view on anything a model of a 3d multi_array? (for the sake of this discussion, element is always double).
Code: ...
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Antonio Piccolboni
-
Ronald Garcia