#include <functional>
void third_party(int n, std::function<void(int)> f)
{
f(n);
}
struct foo
{
template <typename... Args>
void invoke(int n, Args&&... args)
{
auto bound = std::bind(&foo::invoke_impl<Args&...>, this,
std::placeholders::_1, std::forward<Args>(args)...);
third_party(n, bound);
}
template <typename... Args>
void invoke_impl(int, Args&&...)
{
}
};
int main()
{
foo f;
f.invoke(1, 2);
}
I2luY2x1ZGUgPGZ1bmN0aW9uYWw+Cgp2b2lkIHRoaXJkX3BhcnR5KGludCBuLCBzdGQ6OmZ1bmN0aW9uPHZvaWQoaW50KT4gZikKewogIGYobik7Cn0KCnN0cnVjdCBmb28KewogIHRlbXBsYXRlIDx0eXBlbmFtZS4uLiBBcmdzPgogIHZvaWQgaW52b2tlKGludCBuLCBBcmdzJiYuLi4gYXJncykKICB7CiAgICBhdXRvIGJvdW5kID0gc3RkOjpiaW5kKCZmb286Omludm9rZV9pbXBsPEFyZ3MmLi4uPiwgdGhpcywKICAgICAgICAgICAgICAgICAgICAgICAgICAgc3RkOjpwbGFjZWhvbGRlcnM6Ol8xLCBzdGQ6OmZvcndhcmQ8QXJncz4oYXJncykuLi4pOwoKICAgIHRoaXJkX3BhcnR5KG4sIGJvdW5kKTsKICB9CgogIHRlbXBsYXRlIDx0eXBlbmFtZS4uLiBBcmdzPgogIHZvaWQgaW52b2tlX2ltcGwoaW50LCBBcmdzJiYuLi4pCiAgewogIH0KfTsKCmludCBtYWluKCkKewogICAgZm9vIGY7CiAgICBmLmludm9rZSgxLCAyKTsKfQ==