I'm not sure if this counts as beautiful, but you might consider this:
std::function<void(int)> dfs = [&](int x) -> void { // .... dfs(x);};dfs(0);
The compiler may be able to inline the std::function call, but only in simple cases. Of course, it cannot fully inline a recursive function.