我知道如何通过分配器创建1d数组(如a[10]
)。举例来说,这里是从cppreference抽象:如何为int a [10] [10]分配内存分配器
#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;
}
我不知道,但知道如何创建一个二维数组,像int a[10][10]
。有人可以帮我解决这个问题吗?
这不是'C' .. –
[我如何在C++中使用new声明一个2d数组](http://stackoverflow.com/questions/936687/how-do-i-declare-a-2d- array-in-c-using-new) – Rogus