class ARRAY {
public:
int *array;
ARRAY(int size);
void INSERT(int data);
};
ARRAY::ARRAY(int size) {
array = new int[size];
}
void ARRAY::INSERT(int data) {
array[data] = data;
return;
}
This is a class of array.
And I want to pass a ARRAY class' method to some function's argument that measure a runtime.
typedef void (ARRAY::*arrFuncCall)(int);
clock_t measure_time(arrFuncCall func, int iterate) {
clock_t start = clock();
for (int i = 0; i < iterate; i++)
func(i);
clock_t end = clock();
return end - start;
}
But I keep seeing an error in
for (int i = 0; i < iterate; i++)
func(i);
That expression preceding parentheses of apparent call must have (pointer-to-) function type
in func
Why am I seeing this error?