Folding in C++ using Variadic Function Template
Too Long; Didn't Read
Template parameter pack was introduced in C++11. Today we will use it to write our own fold function. We essentially peel of the first argument from the pack and call the binary function with it and evaluation of fold applied to the remainder of the pack. We can call our fold function in the following manner. When we call fold in main, the general case is selected by the. compiler and it deduces the types for the. argument. This is a sort of the. representation of our tree.