I would like to be able to convert between std::vector and its underlying C array int* without explicitly copying the data.
Does std::vector provide access to the u
If you have very controlled conditions, you can just do:
std::vector v(4,100);
int* pv = &v[0];
Be warned that this will only work as long as the vector doesn't have to grow, and the vector will still manage the lifetime of the underlying array (that is to say, don't delete pv). This is not an uncommon thing to do when calling underlying C APIs, but it's usually done with an unnamed temporary rather than by creating an explicit int* variable.