We know that if we have a vector like
std::vector<int> a_vector;
and this vector has elements, we can have the array of elements from
int *the_array= a_vector.data();
My question is: How can we do the opposite?
int the_array[5]={1,2,3,4,5};
std::vector<int> a_vector;
a_vector.data=the_array; //this does not seem to work
To clarify, I don't wish to copy the values , nor create an array *from * the values but have them in the same memory area.
Also , why am I asking this?
I would like to have this original array, in a managed (unified) area of memory
__device__ __managed__ int the_array[5];
and build the vector to point there.