Skip to content

Instantly share code, notes, and snippets.

@kalman5
Last active January 25, 2020 08:36
Show Gist options
  • Select an option

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

Select an option

Save kalman5/d32d2fbcec54825cd6299ecd95f65611 to your computer and use it in GitHub Desktop.
template <typename F>
void PrePost(const F& 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