The following code does not compile ... any idea why? Is it illegal C ++?
class Handler {
public:
template <typename T>
void handle(T t) {}
};
class Initializer {
public:
template <typename T, typename H>
void setup(H *handler) {
void (H::*handle)(T) = &H::handle<T>;
}
};
int main() {
Initializer initializer;
Handler handler;
initializer.setup<int, Handler>(&handler);
}
source
share