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 AP
- Are there implementation guarantees in the stl that vector is,
internally, consecutive in memory
Yes, it is a dynamic array. Standard guarantees that the objects inside vector are stored consecutively.
- Can I safely cast a std::vector to int* and expect that to work?
No, but you can use begin() and use that as the pointer.
- Are there implementation guarantees in the stl that vector is,
internally, consecutive in memory
No, since vector may contain some internal member variables the whole 2D array will not be continuos memory location