Skip to content

Instantly share code, notes, and snippets.

@NTG-TPL
Last active July 11, 2023 11:11
Show Gist options
  • Save NTG-TPL/763dba97b85ba3c332ba39e3903789fd to your computer and use it in GitHub Desktop.
Save NTG-TPL/763dba97b85ba3c332ba39e3903789fd to your computer and use it in GitHub Desktop.
Apply the function to all arguments
// The "ApplyToMany" template applies the function f (the first argument) sequentially to each of its other arguments
template <typename Function, typename ...Args>
void ApplyToMany(Function& f, Args&& ...args) {
((f(std::forward<Args>(args))),...);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment