Use a lambda as a parameter for a C++ function [duplicate]

You have 2 ways: make your function template:

template <typename F>
void myFunction(F&& lambda)
{
    //some things
}

or erase type (with std::function for example):

void
myFunction(const std::function<void()/*type of your lamdba::operator()*/>& f)
{
    //some things
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)