
Sorry, I should have actually checked my response... This one works : #include <boost/units/io.hpp> #include <boost/units/quantity.hpp> #include <boost/units/systems/si.hpp> #include <iostream> using namespace boost::units; // functor for velocity as a function of time struct F { typedef quantity<si::time> arg_type; typedef quantity<si::velocity> ret_type; // constant velocity ret_type operator()(const arg_type& t) const { return 1.0*si::meters/ si::second; } }; template<class F> typename multiply_typeof_helper<typename F::ret_type,typename F::arg_type>::type integrate(F& f,typename F::arg_type a,typename F::arg_type b) { // put actual integration algorithm here... return f(b)*(b-a); } int main(void) { F f; std::cout << integrate(f,0.0*si::seconds,1.0*si::seconds) << std::endl; }