std::deque memory-address as array

985 views Asked by At

I know that it is legal to "convert" a vector to a c-style Array using the following method:

std:vector<char> v;
char *c = &v[0];

Is the same also true for a std::deque?

1

There are 1 answers

0
Baum mit Augen On BEST ANSWER

No. In general, the contents of a std::deque are not stored contiguously:

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

From here.