Simple question. I have a pointer to an array.
vector<int> myVector = { 22, 18, 12, -4, 58, 7, 31, 42 };
int* myPtr = myVector.data();
I also have a function that takes a reference to an array as a parameter.
template<typename T> void sort_quick(T (&arr)[]);
How can I pass my vector's array to this function without having to copy the potentially huge array in data().
sort_quick(*arr); // No matching function call for 'sort_quick'
Also, I need to pass it as an array, it's a pre-requisite, so don't come talking about just passing the vector because I wish I could.
Edit:
template<typename T, int N> void sort_quick(T (&arr)[N]);
This should now be legal syntax?
Edit2:
template<typename T> void sort_quick(T* arr, size_t length);
I believe this would be the best version then, when needing to deal with arrays and not vectors.