jeudi 7 décembre 2017

Pointer to std::vector, pointer declaration

Are there any differences between these two pointer declarations to pass a std::vector to a function that has a special signature that I don't really understand?

libraryFunction (int numSamples, double* const* arrayOfChannels) { 
  //things
}

std::vector<double> theVectorA = {11, 22, 33, 44};
double * p_VecA[1];
p_VecA[0] = theVectorA.data();
libraryFunction(theVectorA.size(), p_VecA);

std::vector<double> theVectorB = {55, 66, 77};
double * p_VecB = theVectorB.data();
libraryFunction(theVectorB.size(), p_VecB);

What are the differences between p_VecA and p_VecB? Can you explain the function signature? I don't understand the "double* const* arrayOfChannels

Aucun commentaire:

Enregistrer un commentaire