std::vector and c-style arrays
问题 I am experimenting with OpenCL to increase the speed of our software. We work with maps a lot and, to simplify, represent a map as a std::vector< std::vector >. The OpenCL API takes raw c-style pointers as arguments, for example int* in the case above. My questions: Are there implementation guarantees in the stl that vector is, internally, consecutive in memory? Can I safely cast a std::vector to int* and expect that to work? In the case of a vector of vectors, can I still assume this holds