List Comprehensions in C++  

From Bartosz Milewski’s What Does Haskell Have to Do with C++?: Haskell style list comprehensions of the form

one x = 1
count lst = sum [one x | x <- lst]

can be written in modern C++ like so:

template<class T> struct
one {
    static const int value = 1;

template<class... lst> struct
count {
    static const int value = sum<one<lst>::value...>::value;

The author calls out the comparison between one<lst>::value... and [one x | x <- lst]. I’ve used packs like this before, but looking at this juxtaposition was a revelation.