#include <iostream>

template<typename Functor, unsigned = 0>
struct Wrapper
{
    static void DoCallback(Functor f)
    {
        f();
    }
};
template<typename Functor>
struct Wrapper<Functor, 1>
{
    static void DoCallback(Functor f)
    {
        f(1, 2);
    }
};
template<typename Functor>
void DoCallback(Functor f)
{
    Wrapper<Functor>::DoCallback(f);
}

struct f1
{
    void operator()(){std::cout << "f1" << std::endl;}
};
struct f2
{
    void operator()(int x, int y){std::cout << "f2 with " << x << ", " << y << std::endl;}
};


int main()
{
    f1 a;
    f2 b;
    DoCallback(a);
    DoCallback(b);
}
