Originally Posted by
Know_Your_Role
Any suggestions about how I might get round this? The context, as you may have guessed, is to allow the user to define the size of a custom checkers board.
If by user you mean a programmer using your checkerboard library, then you could go with something like this:
Code:
#include <cstddef>
template<std::size_t N, std::size_t M>
class Checkerboard
{
public:
// ...
private:
int board[N][M];
};
// ...
int main()
{
Checkerboard<8, 8> customCheckersBoard;
// ...
}
But if by user you mean a user of your program, then you might consider using a std::vector<std::vector<int> > or Boost.MultiArray.