我知道使用以下方法将 vector “转换”为 c 样式数组是合法的:
std:vector<char> v;
char *c = &v[0];
对于 std::deque 也是如此吗?
最佳答案
没有。通常,std::deque
的内容不是连续存储的:
As opposed to std::vector, the elements of a deque are not stored contiguously: typical implementations use a sequence of individually allocated fixed-size arrays
来自 here .
关于c++ - std::deque 内存地址作为数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30778669/