Boost logo

Boost Users :

From: Kobi Cohen-Arazi (kobi.cohenarazi_at_[hidden])
Date: 2006-05-24 10:43:54


Hi,

I've started reading Abrahams' and Gurtovoy's book, since I'm very
interested in boost.mpl. Seems like a great book. I have a question
regarding the 3rd chapter (3.1.4 section).
Eventually, it says that operator* multiplies the runtime values
(resulting in 6.0f) and the code uses transform to sum the meta-seq.

template <class T, class D1, class D2>
quantity<T, typename mpl::transform<D1,D2, plus_f>::type>
operator*(quantity<T,D1> x, quantity<T,D2> y)
{
   typedef mpl::transform<D1,D2, plus_f>::type dim;
   return quantity<T,dim>(x.value() * y.value());
}

1. Why passing x and y by value? why not const&
2. How did we got 6f ?
3. How and when the mpl::transform is getting into action here? I
cannot spot it.

Thanks

-- 
- Kobi

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