Folding in C++ using Variadic Function Templateby@SoulCollector
789 reads

Folding in C++ using Variadic Function Template

tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

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

@SoulCollector

Kshiteej

Receive Stories from @SoulCollector

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa