paint-brush
Folding in C++ using Variadic Function Templateby@SoulCollector
815 reads
815 reads

Folding in C++ using Variadic Function Template

by Kshiteej3mApril 4th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

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.
featured image - Folding in C++ using Variadic Function Template
Kshiteej HackerNoon profile picture
Kshiteej

Kshiteej

@SoulCollector

L O A D I N G
. . . comments & more!

About Author

Kshiteej HackerNoon profile picture
Kshiteej@SoulCollector

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite