
Hi,
Lately I am using Boost.Units quite intensively for defining lots of
thermodynamic functions. The other day I needed a root finding algorithm
that can work on one of these functions. I look at couple of libraries,and
I ended up rolling and adaptor that adimensionalizes the function on
Boost.Units quantities, etc, etc.
Then I though, hey! we have Boost.Math tools, even root finding algorithms,
and these functions are *very* generic as Boost is supposed to be. And I
found the function:
boost::math::tools::bracket_and_solve_root
which has the perfect underlying algorithm for the application.
I started programming and after several compilation errors I realized that,
as happened before, the functions are not generic enough. For example the
arguments are
bracket_and_solve_root( F f, const T& guess, const T& factor, bool rising,
Tol tol, boost::uintmax_t& max_iter);
in my case "guess" is an argument type of type
boost::units::quantitysi::meter but then "factor" has to be a *different*
type. For this function to be generic one need that factor is of new type
parameter.
In my opinion the function should be
template