1
bool cmp(const void * a, const void * b) {
return static_cast < /*type?*/ * > a < static_cast < /*type?*/ * > b;
}
const void * min(const void * first, const void * last, size_t size, compare cmp) {
void * minor = * first;
while (first != last) {
if (cmp(first, first++)) {
* minor = * first;
}
* first++;
}
}
I’m trying to do a function that the output is the first occurrence of the smallest element, and the prototype of the function is
const void * min(const void * first, const void * last, size_t size, Compare cmp);
and need to program the Cmp function that returns true if a < b and the prototype has to be
bool cml ( const void * a, const void * b);
Obs: the code has to be done in c++
I’m not sure what you’re asking. want to know what the function that is passed as parameter is like?
– Maniero
also not understood very well, you want to understand why the type of return is const void ? Take a look here
– Leila