I've got an issue: no matching function for call to ‘begin(int*&)’ The only hint I've found on it is that compiler might not know the size of array at compile time, but I believe that's not my case. Here is what I've got:
template <typename T>
void heapSort(T array[]) {
size_t length = std::end(array) - std::begin(array);
if (length == 0) {
return;
}
Heap<T> heap(array);
for (size_t i = length - 1; i >= 0; --i) {
array[i] = heap.pop();
}
}
int main() {
int array[] = {9, 8, 10, 99, 100, 0};
for (auto i = 0; i < 6; ++i) {
std::cout << array[i] << " ";
}
std::cout << std::endl;
heapSort(array);
for (auto i = 0; i < 6; ++i) {
std::cout << array[i] << " ";
}
std::cout << std::endl;
}
What's the problem? How can I solve it?