#include <iostream>
#include <memory>
#include <functional>
using namespace std;
class A {
public:
std::function<int()> operator[] (int i) {
return [i](){
return i;
};
}
};
int main() {
A a;
cout << a[5]() << endl; // <- 5
cout << a[6]() << endl; // <- 6
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5PgojaW5jbHVkZSA8ZnVuY3Rpb25hbD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgpjbGFzcyBBIHsKcHVibGljOgoJc3RkOjpmdW5jdGlvbjxpbnQoKT4gb3BlcmF0b3JbXSAoaW50IGkpIHsKCQlyZXR1cm4gW2ldKCl7CgkJCXJldHVybiBpOwoJCX07Cgl9Cn07CgppbnQgbWFpbigpIHsKCUEgYTsKCWNvdXQgPDwgYVs1XSgpIDw8IGVuZGw7IC8vIDwtIDUKCWNvdXQgPDwgYVs2XSgpIDw8IGVuZGw7IC8vIDwtIDYKCQoJcmV0dXJuIDA7Cn0K