Why doesn't this inner class compile?
Posted
by Vincenzo
on Stack Overflow
See other posts from Stack Overflow
or by Vincenzo
Published on 2010-05-25T10:00:01Z
Indexed on
2010/05/25
10:21 UTC
Read the original article
Hit count: 129
c++
This is my code:
#include <algorithm>
class A {
void f() {
struct CompareMe {
bool operator() (int i, int j) { return i < j; }
} comp;
int a[] = {1, 2, 3, 4};
int found = std::min_element(a[0], a[3], comp);
}
}
Error message:
no matching function for call to ‘min_element(int&, int&, A::f()::CompareMe&)
What am I doing wrong?
© Stack Overflow or respective owner