Skip to content

Instantly share code, notes, and snippets.

@vivekfe
Last active January 28, 2023 22:53
Show Gist options
  • Save vivekfe/27bc95f302529f6bb9ebb93c21e28343 to your computer and use it in GitHub Desktop.
Save vivekfe/27bc95f302529f6bb9ebb93c21e28343 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <functional>
int catch_lambda(std::function<int(int, int)> func, int x, int y) {
return func(x, y);
}
int main()
{
int x = 5, y = 7;
auto adder = [](int a, int b) { return a + b; };
int result = catch_lambda(adder, x,y);
std::cout << result << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment