
"Andy Little"
Anyway I have continued hacking away and so here is my latest efforts, using fusion to do a dot product of two vectors. Maybe it would be a useful example in the fusion docs?. Anyway here it is FWIW:
A couple of bugs found in my code, as detailed below . ---> Also I found I had to comment out the specialisation of as_vector<0> in < boost/fusion/sequence/conversion/detail/as_vector.hpp> in the Boost Review version to get it to compile OK in GCC4.0.1 I havent tried the CVS version of the file but it looks unchanged relative to my version. regards Andy Little <...>
// more arg reversing template <typename F> struct reverse_f_args{
template
struct result{ typedef typename F:: template result< Rhs,Lhs >::type type; }; template typename result ::type operator()( Rhs const & rhs, Lhs const & lhs )const { F f;
- f(lhs,rhs); + return f(lhs,rhs); ---------------------- <...>
// do the dot_product
- - result_type result = boost::fusion::fold( - + + result_type result = 0; + + boost::fusion::fold( -------------------------------------------------
boost::fusion::transform(seq1,seq2,quan::operator_times()), boost::ref(result), quan::fusion::reverse_assign_f_argsquan::operator_plus_equals() ); assert(quan::compare(result,30,1e-12) ==0); std::cout << result <<'\n';
} -----------------------------