09/02/13 08:55:07
boost::multi_arrayで、以下のようなソースがコンパイルが通らなくて困っています。
どこが間違っているのか教えてください。nの代わりに即値を使うとコンパイルできます。
array_type自体のtypedefはうまくいっているようです。
#include <boost/multi_array.hpp>
template <unsigned int n>
class Test
{
typedef boost::multi_array<int, n> array_type;
typedef array_type::index array_index; // ここでエラー
array_type array;
public:
Test(){}
};
int main () {
Test<3> m3;
Test<4> m4;
}
----
g++ -Wall -g -I /usr/include/boost-1_33_1 -o a.exe multiarray.cpp
multiarray.cpp:7: error: type `boost::multi_array<int, n, std::allocator<int> >' is not derived from type `Test<n>'
multiarray.cpp:7: error: ISO C++ forbids declaration of `index' with no type
multiarray.cpp:7: error: expected `;' before "array_index"
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)