Skip to content

Instantly share code, notes, and snippets.

@dcolish
Created August 14, 2012 00:01
Show Gist options
  • Select an option

  • Save dcolish/3344953 to your computer and use it in GitHub Desktop.

Select an option

Save dcolish/3344953 to your computer and use it in GitHub Desktop.
#include <functional>
#include <iostream>
using namespace std::placeholders;
int add(int a, int b) {
return a + b;
}
int main () {
auto add1 = std::bind(std::plus<int>(), _1, 2);
std::cout << add1(2) << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment