Sorry for not providing enough info (as STL complained about)

No problem, anyway my answer isn't quite right. void(int) will only work with std::function, what std::function does to achieve this is close to magic Smiley

 

In your case you'll have to stick to something simpler:

guard<S_FUNC> g(func);