Could you kindly tell me why the following code does not compile? I guess it is an allocator issue, but how do I go further?
#include <boost/multi_array.hpp>
#include <iostream>
using namespace std;
int
main () {
class test{
int x;
int y;
};
typedef boost::multi_array<test, 3> array_type;
typedef array_type::index index;
array_type A(boost::extents[3][4][2]);
array_type::extent_gen extents;
return 0;
}
compile errors:
multiArray.cpp:11: error: template argument for ‘template<class _Alloc> class std::allocator’ uses local type ‘main()::test’
multiArray.cpp:11: error: trying to instantiate ‘template<class _Alloc> class std::allocator’
multiArray.cpp:11: error: template argument 3 is invalid
multiArray.cpp:11: error: invalid type in declaration before ‘;’ token
multiArray.cpp:12: error: expected initializer before ‘index’
multiArray.cpp:13: error: cannot convert ‘boost::detail::multi_array::extent_gen<3ul>’ to ‘array_type’ in initialization
multiArray.cpp:14: error: expected initializer before ‘extents’
--
R Suresh Kumar,
http://www.ee.ucr.edu/~sramachandrannaSarve bhavantu sukinaha (May everyone be happy)
Sarve santu niramiyaha (May everyone be without affliction)
Sarve bhadrani pashyantu (May everyone see only goodness)
Ma kashchit dukha bhak bhavet (Let none be the victim of suffering)