Fold Expressions
Get to know the types of fold expressions added in C++17 and their benefits in this lesson.
We'll cover the following...
We'll cover the following...
Implementing fold expressions
A fold expression is an expression involving a parameter pack that folds (or reduces) the elements of the parameter pack over a binary operator. To understand how this works, we’ll look at several examples. Earlier in this section, we implemented a variable function template called sum that returned the sum of all its supplied arguments.
For convenience, we’ll show it again here: