C++相談室 part66at TECH
C++相談室 part66 - 暇つぶし2ch60:デフォルトの名無しさん
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)



次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch