观看以下代码片段.在所有平台上的所有情况下,输出总是错误的吗?
std::vector<std::vector<int>> array(5);
array[0].resize(1);
std::vector<int>* arr_start = array.data();
int* p_start = array[0].data();
while( p_start == array[0].data())
{
array[0].push_back(0);
}
std::cout << "Does a reallocation in a vector leads to a reallocation in the parent vector? "
<< array.data() != arr_start;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
54 次 |
| 最近记录: |