Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
c++で最初のサイズなしで2番目または多次元配列を宣言するにはどうすればよいですか?
class numeric { public: int int_array_numbers[][]; ... };
エラー メッセージ: 多次元配列としての 'int_array_numbers' の宣言には、最初の次元を除くすべての次元の境界が必要です
できません。C++ は VLA (可変長配列) をサポートしていません。
std::vector<std::vector<int> >代わりにaを使用してください。
std::vector<std::vector<int> >
このような2つの引数からクラスをテンプレートとして宣言できます
template <int N, int M> class numeric { public: int int_array_numbers[N][M]; ... };