Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
template<typename... Vals>
constexpr int average(Vals... ds)
{
return (... + ds) / sizeof...(ds);
}
// Compute the value `3` at compile time
average(1, 2, 3, 4, 5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.