List comprehension in c++

⮜ Go Back

List comprehension in c++

An attempt to mimic the handiness of list comprehension in python.

PYTHON

C++ with macros 'each' and 'only'

C++ with lambda instead of macros

The classes can be placed in a header file:

And then it can be used with different containers like this:

It can be implemented in one function à la:

But I wanted to have a unified way to access the container after it's created

[Get it on github]