I have the following function
template<class Function>
void f(Function&& g) {
h(..., [&g](){g();});
}
It's a function f
accepting a function, a lambda or a functor as argument. Inside it calls the function h
to which I pass a lambda as argument that is calling g
and receives g
by capture.
- Should I pass
g
or&g
in the capture field of the lambda ? - Will the functor be copied with the above code ?