----- Original Message ----- 
From: "Joel de Guzman" <[EMAIL PROTECTED]>

> A good start is libs/phoenix/test/functors_tests.cpp 
> and libs/phoenix/example/fundamental/sample3.cpp
> There are jamfiles in there FWIW.


BTW, here's the lambda-lambda solution posed by Joel Young:

#include <iostream>
#include "boost/phoenix/operators.hpp"
#include "boost/phoenix/primitives.hpp"
#include "boost/phoenix/composite.hpp"
#include "boost/phoenix/functions.hpp"

//////////////////////////////////
using namespace std;
using namespace phoenix;

//////////////////////////////////
struct square_ {

    template <typename X>
    struct result { typedef X type; };

    template <typename X>
    X operator()(X x)
    {
        return x * x;
    }
};

function<square_> square;

//////////////////////////////////
template <typename F>
struct ffx {

    template <typename X>
    struct result { typedef X type; };

    ffx(F f_) : f(f_) {}

    template <typename X>
    X operator()(X x)
    {
        return f(f(x));
    }

    F f;
};

template <typename F>
function<ffx<F> >
doub(function<F> f)
{
    return function<ffx<F> >(f.op);
}

//////////////////////////////////
int
main()
{
    cout << doub(square)(5.0)() << endl;
    cout << doub(doub(square))(5.0)() << endl;
    cout << doub(doub(doub(square)))(5.0)() << endl;
    return 0;
}

Cheers,
Joel de Guzman
[EMAIL PROTECTED]
http://www.boost-consulting.com



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to