Skip to content

Instantly share code, notes, and snippets.

@kalman5
Last active January 24, 2020 23:07
Show Gist options
  • Save kalman5/cc869f8abf4517245440d5717f9e4a59 to your computer and use it in GitHub Desktop.
Save kalman5/cc869f8abf4517245440d5717f9e4a59 to your computer and use it in GitHub Desktop.
template <typename F, typename... ARGS>
void PrePost(const F& f, ARGS&&...args) {
std::cout << "pre\n";
f(std::forward<ARGS>(args)...);
std::cout << "post\n";
}
int main() {
double a = 1.1;
double b = 2.2;
double c = 3.3;
PrePost([](auto&& a, auto&& b, auto&& c){
std::cout << a << " " << b << " " << c << "\n";
}, a, b, c);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment