#include <iostream>
#include <functional>
using namespace std::placeholders;

int foo(int i)
{
    return i*2;
}

int main(int argc, const char *argv[])
{
    std::function<int(int, int)> barfunc = std::bind(foo, (_1, _2));
    std::cout << barfunc(-999, 21) << std::endl;

    // or even (thanks Xeo)
    barfunc = std::bind(foo, _2);
    std::cout << barfunc(-999, 21) << std::endl;
}
