Fixed point combinator in C++1x
I hav tried the same thing in G++ (version 4.5 from Ubuntu 11.04 original), and the result is quite impressing me. We now do have a lot more features to generise the solution. 


we can now support any number of parameters without modifying the code.
the t2t class is no longer needed as G++ lambda supports accessing all identifiers in scope, including global things. 


I also tried write a free template function to access the internal function. And the result looks good. I just wanted to say: it is elegant!

#include &lt;iostream&gt;
#include &lt;functional&gt;

template&lt;typename R, typename... V&gt;
struct fixpoint
{
    typedef std::function&lt;R (V...)&gt; func_t;
    typedef std::function&lt;func_t (func_t)&gt; tfunc_t;
    typedef std::function&lt;func_t (tfunc_t)&gt; yfunc_t;

    class loopfunc_t {
    public:
        func_t operator()(loopfunc_t v)const {
            return func(v);
        }
        template&lt;typename L&gt;
        loopfunc_t(const L &amp;l):func(l){}
        loopfunc_t(){}
    private:
        std::function&lt;func_t (loopfunc_t)&gt; func;
    };
    static func_t Fix(tfunc_t f){
        return [](loopfunc_t x){ return x(x); }
        ([f](loopfunc_t x){ return [f, x](V... v){ return f(x(x))(v...); }; });
    }
};
template&lt;typename T&gt;
struct getfixpoint
{
    typedef typename getfixpoint&lt;decltype(&amp;T::operator())&gt;::fp fp;
};
template&lt;typename R, typename T, typename... V&gt;
struct getfixpoint&lt;std::function&lt;R (V...)&gt; (T::*)(std::function&lt;R (V...)&gt;)&gt;
{
    typedef fixpoint&lt;R, V...&gt; fp;
};
template&lt;typename R, typename T, typename... V&gt;
struct getfixpoint&lt;std::function&lt;R (V...)&gt; (T::*)(std::function&lt;R (V...)&gt;)const&gt;
{
    typedef fixpoint&lt;R, V...&gt; fp;
};
template&lt;typename R, typename... V&gt;
struct getfixpoint&lt;std::function&lt;R (V...)&gt; (*)(std::function&lt;R (V...)&gt;)&gt;
{
    typedef fixpoint&lt;R, V...&gt; fp;
};

template&lt;typename T&gt;
auto getFix(T f) -&gt; typename getfixpoint&lt;T&gt;::fp::func_t {
    return getfixpoint&lt;T&gt;::fp::Fix(f);
};

int main(int argc, char* argv[])
{
    auto fac = getFix([](std::function&lt;int (int)&gt; f) -&gt; std::function&lt;int (int)&gt;{
        return [f](int n)-&gt;int { if(n==0) return 1; else return n * f(n-1); };
    });
    std::cout&lt;&lt;fac(10)&lt;&lt;std::endl; //3628800
    return 0;
}