std::deque 内存地址作为数组
std::deque memory-address as array
我知道使用以下方法 "convert" 向量到 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.
我知道使用以下方法 "convert" 向量到 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.