比如
class Test{
int array[len][len];
}
array是存储在堆上还是栈上(是否需要考虑数组的爆栈)?和类的实例化方式有关吗?
都15年了该用c++11了
智能指针更安全
//分配在堆上,多了不会爆栈,当然也不能大的太离谱了
auto test_ptr = shared_ptr<Test>(new Test());
//在栈上,多了会爆栈的
Test test;
Test * test_ptr = new Test(); 分配在堆上
Test test; 在栈上
Test *ptr = new Test;
Test::array在堆上, ptr本身在栈上...
要看类实例化在哪上