
Andy Little wrote:
"Joel de Guzman"
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
struct result{ typedef BOOST_TYPEOF_TPL(A() * B()) type; }; template
typename result::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?
Sounds good. Okidoki. Cheers, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net