I know how to create an 1d array (like a[10]
) through an allocator. For instance, here is an abstract from cppreference:
#include <memory>
#include <iostream>
#include <string>
int main()
{
std::allocator<int> a1; // default allocator for ints
int* a = a1.allocate(10); // space for 10 ints
a[9] = 7;
std::cout << a[9] << '\n';
// the remainder was omitted .....
return 0;
}
I do not, however, know how to create a 2D array, like int a[10][10]
. Can someone help me with that, please?