I am having a hard time finding the answer to the following:
What is the best practice way of allocating a 2d array of ints that is contiguous in memory on the heap in c++14.
Conditions:
- The width and height is known at compile time but I would still like to put the 2d array on the heap for various reasons.
- I would like to access memory locations using the 2d syntax arr[x][y]
- I do not want to implement my own wrapper if possible
Sub questions:
- Do I have to use std::array or is the native int[][dim] syntax usable?
- Is it possible to have a unique_ptr to the 2d array?
Thanks in advance for answers.