Boost logo

Boost Users :

From: Andy Little (andy_at_[hidden])
Date: 2006-09-09 11:15:31


"Joel de Guzman" <joel_at_[hidden]> wrote
> Andy Little wrote:

>> Maybe it would be a useful example in the fusion docs?. Anyway here it is
>> FWIW:
>
> Yes, definitely! I'll have to ask for documentation though. A simple
> readme file is ok, plus, lots of comments.

OK. Bear in mind that its reliant 3 functors, multiply, add, and add-and-assign.
In order to be agnostic regarding type deduction schemes ( my own, phoenix,
lambda etc), my thought is to present particular versions of the functors
implemented using Boost.Typeof.
For the assignment one it needs to be implemented in terms of
boost::reference_wrapper anyway and with the Lvalue as the right hand argument,
which is AFAICS particular to the use of fold in fusion.

for example :

struct example_multiply{

        template <typename A , typename B>
        struct result{
                typedef BOOST_TYPEOF_TPL(A() * B()) type;
        };

        template <typename A, typename B>
        typename result<A,B>::type
        operator(A const & a, B const & b)
        {
            return a * b;
        }
};

Boost.Typeof will after all be in the next release alongside Boost.Fusion
Is that acceptable?

regards
Andy Little


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net