Skip to content

Instantly share code, notes, and snippets.

@kalman5
Last active January 24, 2020 22:54
Show Gist options
  • Select an option

  • Save kalman5/6f0385e53250e7e01a65b990e9749339 to your computer and use it in GitHub Desktop.

Select an option

Save kalman5/6f0385e53250e7e01a65b990e9749339 to your computer and use it in GitHub Desktop.
void PrePost(const std::function<void(void)>& f) {
std::cout << "pre\n";
f();
std::cout << "post\n";
}
int main() {
double a = 1.1;
double b = 2.2;
double c = 3.3;
PrePost(
[&a, &b, &c](){
std::cout << a << " " << b << " " << c << "\n";
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment