How to make a function that accepts code blocks

  c++

What I am seeking is a way to create a function that accepts a block of code as argument.

I’ve seen this in boost’s for-each loop
But I can’t find a way to do it myself

I’ve searched but didn’t find anything(probably my terminology was wrong)

An example of what I want:

int main() {
    DO_SOMETHING_FUNC(arg1, arg2, arg3) {
        //Block
    }
}

Source: Windows Questions C++

LEAVE A COMMENT