The problem is not the pair - your code is fine in that regard (although you can avoid creating a temporary by using make_pair
template function, this is merely an optimization, not a fix).
The problem is that the constructor expects to see a pointer to piece_pos
or an array of piece_pos
, while you are attempting to pass piece_pos[0]
to it. You cannot create an array "inline" in a function call like this:
piece_pos tmp[1];
...
playAi(column1, colX1, colY1, tmp)
Here is how you can rewrite this code with make_pair
:
playAi(make_pair(10, 110), colX1, colY1, tmp)