#include <iostream>
void callback( int i )
{
std::cout << __PRETTY_FUNCTION__ << " -> " << i << '\n';
}
struct Callback
{
void operator() (int i )
{
std::cout << __PRETTY_FUNCTION__ << " -> " << i << '\n';
}
};
template< typename Func >
void do_callback( Func f, int i)
{
std::cout << __PRETTY_FUNCTION__ << " -> ";
f(i);
}
int main()
{
do_callback( callback, 1 );
do_callback( &callback, 2 );
do_callback( Callback(), 3 );
do_callback( []( int i ){ std::cout << __PRETTY_FUNCTION__ << " -> " << i << '\n'; }, 4 );
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdm9pZCBjYWxsYmFjayggaW50IGkgKQp7CiAgIHN0ZDo6Y291dCA8PCBfX1BSRVRUWV9GVU5DVElPTl9fIDw8ICIgLT4gIiA8PCBpIDw8ICdcbic7Cn0KCnN0cnVjdCBDYWxsYmFjawp7CiAgIHZvaWQgb3BlcmF0b3IoKSAoaW50IGkgKQogICB7CiAgICAgIHN0ZDo6Y291dCA8PCBfX1BSRVRUWV9GVU5DVElPTl9fIDw8ICIgLT4gIiA8PCBpIDw8ICdcbic7CiAgIH0KfTsKCnRlbXBsYXRlPCB0eXBlbmFtZSBGdW5jID4Kdm9pZCBkb19jYWxsYmFjayggRnVuYyBmLCBpbnQgaSkKewogICBzdGQ6OmNvdXQgPDwgX19QUkVUVFlfRlVOQ1RJT05fXyA8PCAiIC0+ICI7CiAgIGYoaSk7Cn0KCmludCBtYWluKCkKewogICBkb19jYWxsYmFjayggY2FsbGJhY2ssIDEgKTsKICAgZG9fY2FsbGJhY2soICZjYWxsYmFjaywgMiApOwogICBkb19jYWxsYmFjayggQ2FsbGJhY2soKSwgMyApOwogICBkb19jYWxsYmFjayggW10oIGludCBpICl7IHN0ZDo6Y291dCA8PCBfX1BSRVRUWV9GVU5DVElPTl9fIDw8ICIgLT4gIiA8PCBpIDw8ICdcbic7IH0sIDQgKTsKfQ==