私はこのコードを持っています:
int board[3][3]; // I am ommiting initialization code for board here so as not to clutter it.
typedef std::vector<std::pair<int [3][3], int> > History;
History hist = History();
const std::pair<int[3][3], int> p = std::make_pair(board, cell);
hist.push_back(p);
しかし、g ++でコンパイルすると、理解できない次のエラーが表示されます。
In file included from /usr/include/c++/4.7/bits/stl_algobase.h:65:0,
from /usr/include/c++/4.7/vector:61,
from performancesystem.h:29:
/usr/include/c++/4.7/bits/stl_pair.h: In instantiation of
‘std::pair<_T1, _T2>::pair(const std::pair<_U1, _U2>&) [with _U1 =
int (*)[3]; _U2 = int; _T1 = int [3][3]; _T2 = int]’:
Test.cpp:74:65: required from here
/usr/include/c++/4.7/bits/stl_pair.h:111:39: error: incompatible types in
assignment of ‘int (* const)[3]’ to ‘int [3][3]’
私は常に、C++ のポインターと配列の違いを理解するのにこの問題を抱えていました。それらは同じものであるべきではありませんか?誰でも私を助けてもらえますか?