From: Geoff Leyland (gley001_at_[hidden])
Date: 2004-06-03 02:18:12
On 3/06/2004, at 6:48 PM, John Phillips wrote:
> *Making generic algorithms generic.
> Templates and overloading, of course, are able to simplify the
> library interface substantially. No more separate names for the float,
> double and complex versions of what is really the same algorithm.
> Some things that may be natural in C++ implementations and very
> difficult or impossible in other libraries (again, not a complete
> list, but the ones I am thinking of at the moment).
With careful planning, there could be a lot of advantages from writing
an object-oriented math library using generic programming etc.
When I first heard about templates I wrote a floating-point-type
generic ODE integrator, which I thought was great. But it was just a
transliteration into C++ of a bog standard algorithm.
Perhaps in a carefully thought-out OO design, each ODE step would be an
object, and so things like recording of results and interpolating at
intermediate points would have trivial interfaces. There may be other
ways of re-thinking numerical algorithms into object oriented or
metaprogramming frameworks - and I think that the C++ expertise of
boost would be a good forum to develop ideas like that.
There's a risk, though, that C++ features intruding to a low level
would slow things down a lot. Can we hope that's something the
compiler writers will sort out?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk