I would like to be able to convert between std :: vector and its underlying C int * array without explicitly copying the data.
Does std :: vector provide access to the underlying C array? I'm looking for something like this
vector<int> v (4,100) int* pv = v.c_array();
EDIT:
In addition, is it possible to do the opposite, that is, how to initialize std::vector from an array C without copying?
int pv[4] = { 4, 4, 4, 4}; vector<int> v (pv);
c ++ c arrays stl stdvector
jelil Nov 14 '09 at 3:33 2009-11-14 03:33
source share